Skip to content

Commit

Permalink
Schema file fixes.
Browse files Browse the repository at this point in the history
Now that we can see the sql errors, there were many issues found within the schema setup. This addresses those errors so updates/installs should install as directely intended.
  • Loading branch information
mastacontrola committed Jan 14, 2017
1 parent 77dbdc1 commit 163e5a6
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 163 deletions.
19 changes: 10 additions & 9 deletions packages/web/commons/schema.php
Expand Up @@ -346,7 +346,7 @@
);
// 8
$this->schema[] = array(
"INSERT IGNORE INTO `supportedOS` (`osName`, `osValue`) VALUES ('"
"INSERT IGNORE INTO `supportedOS` (`osName`, `osValue`) VALUES "
. "('Windows 98','3'),"
. "('Windows (other)','4'),"
. "('Linux','50')",
Expand Down Expand Up @@ -729,7 +729,7 @@
// 14
$this->schema[] = array(
"INSERT IGNORE INTO `globalSettings` "
. "(`settingKey`,`settingDesc`,`settingValue`,`settingCategory`) "
. "(`settingKey`,`settingDesc`,`settingValue`,`settingCategory`) VALUES "
. "('FOG_UTIL_DIR','This setting defines the location of the fog "
. "utility directory.','/opt/fog/utils','FOG Utils')",
"ALTER TABLE `users` ADD COLUMN `uType` VARCHAR(2) NOT NULL AFTER `uCreateBy`",
Expand Down Expand Up @@ -1026,7 +1026,7 @@
"ALTER TABLE `inventory` ADD INDEX (`iHostID`)",
"UPDATE `globalSettings` set `settingKey`='FOG_HOST_LOOKUP' "
. "WHERE `settingKey`='FOG_HOST_LOCKUP'",
"UPDATE `schemaVersion` set `vValue`=`'22'",
"UPDATE `schemaVersion` set `vValue`='22'",
);
// 23
$this->schema[] = array(
Expand Down Expand Up @@ -1247,7 +1247,7 @@
. "\"Active Tasks\" and clicking on the \"Kill Task\" button.', "
. "'memtest.png', '', 'fog', '1', 'both'),"
. "(6, 'Disk Surface Test', 'Disk Surface Test checks the hard "
. "drive's surface sector by sector for any errors and reports "
. "drives surface sector by sector for any errors and reports "
. "back if errors are present.', 'surfacetest.png', '',"
. "'fog', '1', 'both'),"
. "(7, 'Recover', 'Recover loads the photorec utility that can "
Expand Down Expand Up @@ -2876,7 +2876,7 @@
$this->schema[] = array(
"ALTER TABLE `nfsGroupMembers` CHANGE `ngmInterface` "
. "`ngmInterface` VARCHAR (25) CHARACTER SET utf8 "
. "COLLATE utf8_general_ci NOT NULL DEFAULT"
. "COLLATE utf8_general_ci NOT NULL DEFAULT '"
. STORAGE_INTERFACE
. "'",
);
Expand Down Expand Up @@ -3447,14 +3447,16 @@
. "PRIMARY KEY(`uId`),"
. "UNIQUE INDEX `name` (`uName`)"
. ") ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC",
"INSERT IGNORE INTO `users_new` SELECT * FROM `users`",
"INSERT IGNORE INTO `users_new` (SELECT * FROM `users`)",
"DROP TABLE `users`",
"RENAME TABLE `users_new` TO `users`",
);
// 236
$this->schema[] = array(
self::$DB->getColumns('multicastSessions', 'msAnon1') > 0 ?
'ALTER TABLE `multicastSessions`'
. 'CHANGE `msAnon1` `msIsDD` INTEGER NOT NULL',
. 'CHANGE `msAnon1` `msIsDD` INTEGER NOT NULL' :
'',
"ALTER TABLE `imageGroupAssoc` CHANGE `igaPrimary` `igaPrimary` "
. "ENUM('0','1') NOT NULL",
"ALTER TABLE `snapinGroupAssoc` CHANGE `sgaPrimary` `sgaPrimary` "
Expand Down Expand Up @@ -3586,8 +3588,7 @@
'globalSettings',
array(
'settingKey'
),
'settingKey'
)
),
true
);
Expand Down
2 changes: 1 addition & 1 deletion packages/web/lib/fog/schema.class.php
Expand Up @@ -109,7 +109,7 @@ public function dropDuplicateData(
return;
} elseif (count($indexes) === 1) {
$ending = sprintf(
'INDEX `%s`',
'INDEX (`%s`)',
array_shift($indexes)
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/lib/fog/system.class.php
Expand Up @@ -53,7 +53,7 @@ private static function _versionCompare()
public function __construct()
{
self::_versionCompare();
define('FOG_VERSION', '9');
define('FOG_VERSION', '10');
define('FOG_SCHEMA', 245);
define('FOG_BCACHE_VER', 111);
define('FOG_SVN_REVISION', 6052);
Expand Down
24 changes: 16 additions & 8 deletions packages/web/lib/pages/schemaupdaterpage.class.php
Expand Up @@ -152,8 +152,12 @@ public function indexPost()
null,
true
);
$newSchema = self::getClass('Schema', 1);
foreach ((array)$items as $version => &$updates) {
foreach ((array)$updates as &$update) {
if (!$update) {
continue;
}
if (is_callable($update)) {
$result = $update();
if (is_string($result)) {
Expand All @@ -165,38 +169,42 @@ public function indexPost()
. ' <pre>%s</pre></p>',
_('Update'),
_('ID'),
$version,
$version + 1,
_('Function'),
_('Error'),
$result,
_('Function'),
print_r($update, 1)
);
break;
unset($update);
break 2;
}
} elseif (false !== self::$DB->query($update)->error) {
$errors[] = sprintf(
'<p><b>%s %s:</b>'
. ' %s<br/><br/><b>%s %s:</b>'
. ' <pre>%s</pre></p>'
. '<p><b>%s:</b>'
. ' <pre>%s</pre></p>'
. '<p><b>%s:</b>'
. ' <pre>%s</pre></p>',
_('Update'),
_('ID'),
$version,
$version + 1,
_('Database'),
_('Error'),
self::$DB->error,
_('Variable contains'),
print_r($this->schema[$version], 1),
_('Database SQL'),
$update
);
break;
unset($update);
break 2;
} else {
if (!isset($newSchema)) {
$newSchema = self::getClass('Schema', 1);
}
$newSchema->set('version', ++$version);
$newSchema->set('version', $version + 1);
}
unset($update);
}
}
if (!$newSchema->save()
Expand Down
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: fog-project-2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-13 23:53-0500\n"
"POT-Creation-Date: 2017-01-14 01:08-0500\n"
"PO-Revision-Date: 2016-05-23 07:36-0400\n"
"Last-Translator: vspushbullet <vspushbullet@gmail.com>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -128,8 +128,8 @@ msgstr "Drucker konnte nicht erstellt werden."
#: /var/www/fog/lib/fog/fogcontroller.class.php:951
#: /var/www/fog/lib/fog/foggetset.class.php:92
#: /var/www/fog/lib/fog/fogpage.class.php:2293
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:170
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:188
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:174
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:195
#: /var/www/fog/lib/db/pdodb.class.php:177
#: /var/www/fog/lib/db/pdodb.class.php:216
#: /var/www/fog/lib/db/pdodb.class.php:272
Expand Down Expand Up @@ -340,8 +340,8 @@ msgstr "Objekt"
#: /var/www/fog/lib/fog/fogcontroller.class.php:787
#: /var/www/fog/lib/fog/fogcontroller.class.php:799
#: /var/www/fog/lib/fog/fogcontroller.class.php:811
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:167
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:185
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:171
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:192
#: /var/www/fog/commons/text.php:302
msgid "ID"
msgstr "ID"
Expand Down Expand Up @@ -1545,8 +1545,8 @@ msgstr "Hinzufügen"
#: /var/www/fog/lib/pages/groupmanagementpage.class.php:929
#: /var/www/fog/lib/pages/groupmanagementpage.class.php:978
#: /var/www/fog/lib/pages/usermanagementpage.class.php:284
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:166
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:184
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:170
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:191
#: /var/www/fog/lib/pages/hostmanagementpage.class.php:799
#: /var/www/fog/lib/pages/hostmanagementpage.class.php:1049
#: /var/www/fog/lib/pages/hostmanagementpage.class.php:1316
Expand Down Expand Up @@ -2211,13 +2211,13 @@ msgstr "Ausstehende Gastgeber"

#: /var/www/fog/lib/pages/dashboardpage.class.php:137
#: /var/www/fog/lib/pages/dashboardpage.class.php:146
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:223
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:231
msgid "Click"
msgstr "Klicken Sie auf"

#: /var/www/fog/lib/pages/dashboardpage.class.php:140
#: /var/www/fog/lib/pages/dashboardpage.class.php:149
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:224
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:232
#: /var/www/fog/commons/text.php:92
msgid "here"
msgstr "Hier"
Expand Down Expand Up @@ -4577,38 +4577,42 @@ msgstr "Keine Verbindung verfügbar"
msgid "Update not required!"
msgstr "Update wird nicht benötigt!"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:169
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:172
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:173
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:176
#, fuzzy
msgid "Function"
msgstr "Aktion"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:187
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:194
#, fuzzy
msgid "Database"
msgstr "Datum"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:190
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:197
msgid "Variable contains"
msgstr ""

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:199
msgid "Database SQL"
msgstr ""

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:208
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:216
msgid "Install / Update Failed!"
msgstr "Installation / Update fehlgeschlagen!"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:213
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:221
msgid "The following errors occurred"
msgstr "Der folgende Fehler aufgetreten"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:222
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:230
msgid "Install / Update Successful!"
msgstr "Installation / Update erfolgreich!"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:225
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:233
msgid "to login"
msgstr "anmelden"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:230
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:238
msgid "The following errors occured"
msgstr "Der folgende Fehler aufgetreten"

Expand Down
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-13 23:53-0500\n"
"POT-Creation-Date: 2017-01-14 01:08-0500\n"
"PO-Revision-Date: 2016-05-22 15:14-0400\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand Down Expand Up @@ -127,8 +127,8 @@ msgstr "Could not create printer"
#: /var/www/fog/lib/fog/fogcontroller.class.php:951
#: /var/www/fog/lib/fog/foggetset.class.php:92
#: /var/www/fog/lib/fog/fogpage.class.php:2293
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:170
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:188
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:174
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:195
#: /var/www/fog/lib/db/pdodb.class.php:177
#: /var/www/fog/lib/db/pdodb.class.php:216
#: /var/www/fog/lib/db/pdodb.class.php:272
Expand Down Expand Up @@ -339,8 +339,8 @@ msgstr "Object"
#: /var/www/fog/lib/fog/fogcontroller.class.php:787
#: /var/www/fog/lib/fog/fogcontroller.class.php:799
#: /var/www/fog/lib/fog/fogcontroller.class.php:811
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:167
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:185
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:171
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:192
#: /var/www/fog/commons/text.php:302
msgid "ID"
msgstr "ID"
Expand Down Expand Up @@ -1537,8 +1537,8 @@ msgstr "Add"
#: /var/www/fog/lib/pages/groupmanagementpage.class.php:929
#: /var/www/fog/lib/pages/groupmanagementpage.class.php:978
#: /var/www/fog/lib/pages/usermanagementpage.class.php:284
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:166
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:184
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:170
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:191
#: /var/www/fog/lib/pages/hostmanagementpage.class.php:799
#: /var/www/fog/lib/pages/hostmanagementpage.class.php:1049
#: /var/www/fog/lib/pages/hostmanagementpage.class.php:1316
Expand Down Expand Up @@ -2201,13 +2201,13 @@ msgstr "Pending hosts"

#: /var/www/fog/lib/pages/dashboardpage.class.php:137
#: /var/www/fog/lib/pages/dashboardpage.class.php:146
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:223
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:231
msgid "Click"
msgstr "Click"

#: /var/www/fog/lib/pages/dashboardpage.class.php:140
#: /var/www/fog/lib/pages/dashboardpage.class.php:149
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:224
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:232
#: /var/www/fog/commons/text.php:92
msgid "here"
msgstr "here"
Expand Down Expand Up @@ -4562,38 +4562,42 @@ msgstr "No connection available"
msgid "Update not required!"
msgstr "Update not required!"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:169
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:172
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:173
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:176
#, fuzzy
msgid "Function"
msgstr "Action"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:187
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:194
#, fuzzy
msgid "Database"
msgstr "Date"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:190
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:197
msgid "Variable contains"
msgstr ""

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:199
msgid "Database SQL"
msgstr ""

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:208
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:216
msgid "Install / Update Failed!"
msgstr "Install / Update Failed!"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:213
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:221
msgid "The following errors occurred"
msgstr "The following errors occurred"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:222
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:230
msgid "Install / Update Successful!"
msgstr "Install / Update Successful!"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:225
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:233
msgid "to login"
msgstr "to login"

#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:230
#: /var/www/fog/lib/pages/schemaupdaterpage.class.php:238
msgid "The following errors occured"
msgstr "The following errors occured"

Expand Down

0 comments on commit 163e5a6

Please sign in to comment.