function submit_create_action($sql) { //executes a create command $tablename = get_tablename($sql); if (strtoupper(substr($sql, 0, 16)) == 'CREATE ALGORITHM') { // It`s a VIEW. We need to substitute the original DEFINER with the actual MySQL-User $parts = explode(' ', $sql); for ($i = 0, $count = sizeof($parts); $i < $count; $i++) { if (strtoupper(substr($parts[$i], 0, 8)) == 'DEFINER=') { global $config; $parts[$i] = 'DEFINER=`' . $config['dbuser'] . '`@`' . $config['dbhost'] . '`'; $sql = implode(' ', $parts); $i = $count; } } } $res = @mysqli_query($GLOBALS["___mysqli_ston"], $sql); if ($res === false) { // erster Versuch fehlgeschlagen -> zweiter Versuch - vielleicht versteht der Server die Inline-Kommentare nicht? $sql = del_inline_comments($sql); $res = @mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql)); if ($res === false) { // wieder nichts. Ok, haben wir hier einen alten MySQL-Server 3.x oder 4.0.x? // versuchen wir es mal mit der alten Syntax $res = @mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql)); } } if ($res === false) { // wenn wir hier angekommen sind hat nichts geklappt -> Fehler ausgeben und abbrechen SQLError($sql, is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); die("<br>Fatal error: Couldn't create table or view `" . $tablename . "´"); } return $tablename; }
$GLOBALS["SCHEDULE_ID"] = $re[1]; } if (preg_match("#reconfigure-count=([0-9]+)#", implode(" ", $argv), $re)) { $GLOBALS["RECONFIGURE_COUNT"] = $re[1]; } include_once dirname(__FILE__) . '/ressources/class.templates.inc'; include_once dirname(__FILE__) . '/ressources/class.ccurl.inc'; include_once dirname(__FILE__) . '/ressources/class.system.network.inc'; include_once dirname(__FILE__) . '/ressources/class.ext.tarcompress.inc'; include_once dirname(__FILE__) . '/framework/class.unix.inc'; include_once dirname(__FILE__) . '/framework/frame.class.inc'; include_once dirname(__FILE__) . '/framework/class.settings.inc'; if (count($argv) == 0) { die; } downgrade($argv[1]); function downgrade($file) { $unix = new unix(); $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $unix = new unix(); $pid = $unix->get_pid_from_file($pidFile); if ($unix->process_exists($pid)) { Events("??%: A process already exists PID {$pid}"); return; } @file_put_contents($pidFile, getmypid()); $workdir = "/home/squid/downgrade"; $gzf = "/home/squid/downgrade/{$file}"; @mkdir("/home/squid/downgrade", 0755, true); Events("0%: Ask to update package name {$file}");
/** * force a downgrade on a single user, by email */ function run_opp_downgrade_premium($task, $args) { static $loaded; // load application context if (!$loaded) { define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', 'be'); define('SF_ENVIRONMENT', 'task'); define('SF_DEBUG', false); require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; sfContext::getInstance(); sfConfig::set('pake', true); error_reporting(E_ALL); $loaded = true; } if (count($args) < 1 || count($args) > 1) { throw new Exception('Usage: opp-downgrade-premium $USER_ID.'); } $user_id = $args[0]; $user = OppUserPeer::retrieveByPK($user_id); if (!$user instanceof OppUser) { throw new Exception('User not known: ' . $user_id . '.'); } $start_time = microtime(true); downgrade($user_id, $user->getEmail()); $total_time = microtime(true) - $start_time; echo 'Processed in '; echo pakeColor::colorize(sprintf("%f", $total_time), array('fg' => 'cyan')); echo " seconds\n"; }
exit; } if (isset($_GET["dump-peers"])) { dump_peers(); exit; } if (isset($_GET["reconstruct-caches"])) { reconstruct_caches(); exit; } if (isset($_GET["restart-cache-tail"])) { restart_cache_tail(); exit; } if (isset($_GET["downgrade"])) { downgrade(); exit; } if (isset($_GET["current-version"])) { current_version(); exit; } if (isset($_GET["user-retranslation"])) { user_retranslation(); exit; } if (isset($_GET["samba-proxy"])) { samba_proxy(); exit; } if (isset($_GET["idns"])) {
function submit_create_action($sql) { //Führt eine Create-Anweisung durch und ermittelt danach die Anzahl der aktuellen Spalten // und legt diese im Array ab global $restore; $tablename = get_tablename($sql); if (DEBUG) { echo "<br>Tabellenname: " . $tablename; echo "<br>Create: " . $sql; } $res = mysql_query($sql); if (!$res === false) { if (DEBUG) { echo "<br>Create-Anweisung erfolgreich ausgeführt."; } $restore['actual_table'] = $tablename; $restore['table_ready']++; } else { //erster Versuch die Tabelle anzulegen hat nicht geklappt // versuchen wir es mal mit der alten Syntax $res = mysql_query(downgrade($sql)); if (!$res === false) { if (DEBUG) { echo "<br>Create-Anweisung nach Downgrade erfolgreich ausgeführt."; } $restore['actual_table'] = $tablename; $restore['table_ready']++; } else { SQLError($sql, 'Couldn\'t create table: ' . $tablename); die; } } return get_num_rows($tablename); }