Beispiel #1
0
         $createTables = false;
         setupLog(sprintf(gettext('Query %1$s Failed. Error: %2$s'), $sql, db_error()));
         echo '<div class="error">';
         echo sprintf(gettext('Table creation failure:<br />Query: %1$s<br />Error: %2$s'), $sql, db_error());
         echo '</div>';
     } else {
         setupLog(sprintf(gettext('Query ( %s ) Success.'), $sql));
     }
 }
 // always run the update queries to insure the tables are up to current level
 setupLog(gettext("Begin table updates"));
 foreach ($sql_statements as $sql) {
     @set_time_limit(60);
     echo ' ';
     // keep alive
     $result = db_table_update($sql);
     if (!$result) {
         $error = db_error();
         setupLog(sprintf(gettext('Query %1$s Failed. Error: %2$s'), $sql, $error), strpos($error, 'syntax') !== false);
     } else {
         setupLog(sprintf(gettext('Query ( %s ) Success.'), $sql));
     }
 }
 echo "<h3>";
 if ($taskDisplay[substr($task, 0, 8)] == 'create') {
     if ($createTables) {
         echo gettext('Done with table create!');
     } else {
         echo gettext('Done with table create with errors!');
     }
 } else {
/**
 * Executes and logs database update queries
 * @param string $sql
 *
 * @author Stephen Billard
 * @Copyright 2016 by Stephen L Billard for use in {@link https://github.com/ZenPhoto20/ZenPhoto20 ZenPhoto20}
 */
function setupQuery($sql)
{
    global $updateErrors;
    $result = db_table_update($sql);
    if (OFFSET_PATH == 2) {
        //don't write to setup log if not running setup
        if ($result) {
            setupLog(sprintf(gettext('Query Success: %s'), $sql), true);
        } else {
            $updateErrors = true;
            $error = db_error();
            setupLog(sprintf(gettext('Query Failed: %1$s ' . "\n" . ' Error: %2$s'), $sql, $error), true);
        }
    }
    return $result;
}