]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
scripts/upgrade.php would fail if Profile_prefs did not exist
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 27 Nov 2014 13:46:10 +0000 (14:46 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 27 Nov 2014 13:46:10 +0000 (14:46 +0100)
A checkschema.php run would've done it, but that would require an
additional step to our upgrade procedure.

plugins/Favorite/FavoritePlugin.php

index a9a95f80cc9da746c37672af90f70f188fad87fd..017b78d8b9c366e24f0673ca2fa11236ec6471e2 100644 (file)
@@ -59,6 +59,10 @@ class FavoritePlugin extends ActivityHandlerPlugin
         $user->whereAdd('emailnotifyfav IS NOT NULL');
         if ($user->find()) {
             printfnq("Detected old User table (emailnotifyfav IS NOT NULL). Moving 'emailnotifyfav' property to Profile_prefs...");
+            // First we'll make sure Profile_prefs exists
+            $schema = Schema::get();
+            $schema->ensureTable('profile_prefs', Profile_prefs::schemaDef());
+
             // Make sure we have our own tables setup properly
             while ($user->fetch()) {
                 $user->setPref('email', 'notify_fave', $user->emailnotifyfav);