function dump($filename, $gzip_dump_file = false) { $data = serialize($this); if ($gzip_dump_file && function_exists('gzip')) { $data = gzip($data, 6, $filename, 'Interpreter state dump (Garden)'); $filename .= '.gz'; } if (!($f = fopen($filename, 'w') and fwrite($f, $data) and fclose($f))) { throw new Exception('Could not write state dump.'); } }
$cache = unserialize(file_get_contents($lessCacheFile)); } else { $cache = __DIR__ . '/public/css/main.less'; } $less = new lessc(); $less->setFormatter("compressed"); $newCache = $less->cachedCompile($cache); if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) { if (file_put_contents($cssOutput, $newCache['compiled']) !== false) { gzip($cssOutput); file_put_contents($lessCacheFile, serialize($newCache)); } } // minify js $jsDir = __DIR__ . '/public/js/'; $jsOutput = 'compiled.js'; $js = ''; // for this site, the order of including doesn't matter if (file_exists($jsDir)) { foreach (scandir($jsDir) as $file) { if (substr($file, -3) === '.js' && $file !== $jsOutput) { $js .= \JShrink\Minifier::minify(file_get_contents($jsDir . $file)); } } } file_put_contents($jsDir . $jsOutput, $js); gzip($jsDir . $jsOutput); function gzip($inFile, $outFile = null) { file_put_contents($outFile === null ? $inFile . '.gz' : $outFile, gzencode(file_get_contents($inFile), 9)); }
function compressTarGZ($tar_filename, $tar_dir, $compress_level = 5) { $compress_level = $compress_level < 1 || $compress_level > 9 ? 5 : $compress_level; $exit_code = 0; if (pathinfo($tar_filename, PATHINFO_EXTENSION) == 'gz') { $filename = rtrim($tar_filename, '.gz'); } else { $filename = $tar_filename . '.tar.gz'; } $tar = rtrim($tar_filename, '.gz'); //remove archive if exists if (is_file($tar_filename)) { unlink($tar_filename); } if (is_file($filename)) { unlink($filename); } if (is_file($tar)) { unlink($tar); } if (class_exists('PharData')) { try { $a = new PharData($tar); $a->buildFromDirectory($tar_dir); // this code creates tar-file if (file_exists($tar)) { // remove tar-file after zipping gzip($tar, $compress_level); unlink($tar); } } catch (Exception $e) { $error = new AError($e->getMessage()); $error->toLog()->toDebug(); $exit_code = 1; } } else { $exit_code = 1; } if ($exit_code) { $registry = Registry::getInstance(); $registry->get('load')->library('targz'); $targz = new Atargz(); return $targz->makeTar($tar_dir . $tar_filename, $filename, $compress_level); } else { return true; } }
<?php define('IN_ANNOUNCE', 1); require_once 'core_announce.php'; gzip(); foreach (array('passkey', 'info_hash', 'peer_id', 'event', 'ip', 'localip') as $x) { if (isset($_GET[$x])) { $GLOBALS[$x] = '' . $_GET[$x]; } } foreach (array('port', 'downloaded', 'uploaded', 'left') as $x) { $GLOBALS[$x] = 0 + $_GET[$x]; } if (strpos($passkey, '?')) { $tmp = substr($passkey, strpos($passkey, '?')); $passkey = substr($passkey, 0, strpos($passkey, '?')); $tmpname = substr($tmp, 1, strpos($tmp, '=') - 1); $tmpvalue = substr($tmp, strpos($tmp, '=') + 1); $GLOBALS[$tmpname] = $tmpvalue; } if (get_magic_quotes_gpc()) { $info_hash = stripslashes($info_hash); $peer_id = stripslashes($peer_id); } foreach (array('passkey', 'info_hash', 'peer_id', 'port', 'downloaded', 'uploaded', 'left') as $x) { if (!isset($x)) { err('Missing key: ' . $x); } } foreach (array('info_hash', 'peer_id') as $x) { if (strlen($GLOBALS[$x]) != 20) {
} // on fait patienter echo "<br />"; echo "<span id='sauvegarde_en_cours'><p>Sauvegarde en cours...</p></span>"; if (ob_get_contents()) { ob_flush(); } flush(); $t_debut = time(); if (substr(PHP_OS, 0, 3) == 'WIN' && file_exists("mysqldump.exe")) { // on est sous Window$ et on a $filename : "xxxx.sql.gz" $filename = substr($filename, 0, -3); // $filename : "xxxx.sql" $command = "mysqldump.exe --skip-opt --add-drop-table --skip-disable-keys --quick -Q --create-options --set-charset --skip-comments -h {$dbHost} -u {$dbUser} --password={$dbPass} {$dbDb} > {$filename}"; $exec = exec($command); gzip($filename); // on compresse et on obtient un fichier xxxx.sql.gz unlink($filename); // on supprime le fichier xxxx.sql $filename = $filename . ".gz"; // // $filename : xxxx.sql.gz } else { if ($ver_mysql[0] == "5" or $ver_mysql[0] == "4" and $ver_mysql[1] >= "1") { $command = "mysqldump --skip-opt --add-drop-table --skip-disable-keys --quick -Q --create-options --set-charset --skip-comments -h {$dbHost} -u {$dbUser} --password={$dbPass} {$dbDb} | gzip > {$filename}"; } elseif ($ver_mysql[0] == "4" and $ver_mysql[1] == "0" and $ver_mysql[2] >= "17") { // Si on est là, c'est que le serveur mysql est d'une version 4.0.17 ou supérieure $command = "mysqldump --add-drop-table --quick --quote-names --skip-comments -h {$dbHost} -u {$dbUser} --password={$dbPass} {$dbDb} | gzip > {$filename}"; } else { // Et là c'est qu'on a une version inférieure à 4.0.17 $command = "mysqldump --add-drop-table --quick --quote-names -h {$dbHost} -u {$dbUser} --password={$dbPass} {$dbDb} | gzip > {$filename}"; }
background: url(../../../../../images/advanced_search_bg.png) repeat scroll 0 0 rgb(19, 132, 179) !important; color: #FFFFFF; font-weight: bold; }*/ </style> <!-- End of meta content --> <title><?php echo $title; ?> </title> <!--<style> <?php $sPath = $mainpath . '/css/templates/blue/common.css'; $sOutFile = $sPath . '.gz'; echo gzip($sPath, $sOutFile); ?> </style>--> <!--Header--> <div id="header" class="clearfix"> <div class="headerleft"> <div class="logo"> <a href="<?php echo base_url(); ?> "> <img title="<?php echo $this->dx_auth->get_site_title(); ?> " src="<?php