$q = "ALTER TABLE testCreateTableABC ADD bee int"; $db->query($q); $cant_alter = $db->get_error(); // Try and drop a table to test if we have perm $db = new db_alloc(); $db->verbose = 0; $q = "DROP TABLE testCreateTableABC"; $db->query($q); $cant_drop = $db->get_error(); // If we can't do all three, then update the users permissions if ($cant_create || $cant_drop || $cant_alter) { $actions[] = ACTION_FIX_DB_USER_PERMS; } $db->verbose = 1; // Create table patchLog if it doesn't exist if (!$db->table_exists("patchLog")) { $actions[] = ACTION_CREATE_TABLE_PATCHLOG; } $commands[ACTION_RM_ALLOC_INC] = "rm -f " . $old_alloc_inc; $commands[ACTION_CREATE_ALLOC_CONFIG] = "echo '<?php \n" . implode("\n", $newfile) . "\n?>' > " . ALLOC_CONFIG_PATH; $commands[ACTION_MV_PROJECTS_DIR] = "mv " . ATTACHMENTS_DIR . "projects " . ATTACHMENTS_DIR . "project"; $commands[ACTION_MV_CLIENTS_DIR] = "mv " . ATTACHMENTS_DIR . "clients " . ATTACHMENTS_DIR . "client"; $commands[ACTION_MV_TASKS_DIR] = "mkdir " . ATTACHMENTS_DIR . "task; chmod 777 " . ATTACHMENTS_DIR . "task"; $commands[ACTION_ERR_ATTACHMENTS_DIR_NOT_DEFINED] = "echo 'ERROR: No ATTACHMENTS_DIR defined'"; $commands[ACTION_ERR_ATTACHMENTS_DIR_NOT_DIR] = "echo 'ERROR: ATTACHMENTS_DIR is not a directory: " . ATTACHMENTS_DIR . "'"; $commands[ACTION_ERR_ATTACHMENTS_DIR_NOT_WRITEABLE] = "echo 'ERROR: ATTACHMENTS_DIR is not webserver writeable: " . ATTACHMENTS_DIR . "'"; $commands[ACTION_FIX_DB_USER_PERMS] = "mysql -u root mysql -e 'update db set Select_priv=\"y\",Select_priv=\"y\",Insert_priv=\"y\"\n"; $commands[ACTION_FIX_DB_USER_PERMS] .= ",Update_priv=\"y\",Delete_priv=\"y\",Create_priv=\"y\",Drop_priv=\"y\",References_priv=\"y\"\n"; $commands[ACTION_FIX_DB_USER_PERMS] .= ",Index_priv=\"y\",Alter_priv=\"y\" where User = \"" . ALLOC_DB_USER . "\"; flush privileges;'\n"; $commands[ACTION_CREATE_TABLE_PATCHLOG] = "mysql -u root " . ALLOC_DB_NAME . " -e 'CREATE TABLE patchLog ( patchLogID int(11) NOT NULL auto_increment, patchName varchar(255) NOT NULL,"; $commands[ACTION_CREATE_TABLE_PATCHLOG] .= "\npatchDesc text, patchDate timestamp(14) NOT NULL, PRIMARY KEY (patchLogID)) TYPE=ISAM PACK_KEYS=1;";