private function extractBrowscap() { $strReturn = ""; if (!is_file(_realpath_ . _projectpath_ . "/temp/browscap.cache.php")) { $objZip = new class_gzip(); $objFile = new class_filesystem(); $objFile->fileCopy(class_resourceloader::getInstance()->getCorePathForModule("module_stats") . "/module_stats/installer/browscap.cache.php.gz", _projectpath_ . "/temp/browscap.cache.php.gz"); if (is_file(_realpath_ . _projectpath_ . "/temp/browscap.cache.php.gz")) { $objZip->decompressFile(_projectpath_ . "/temp/browscap.cache.php.gz"); $objFile->fileDelete(_projectpath_ . "/temp/browscap.cache.php.gz"); touch(_realpath_ . _projectpath_ . "/temp/browscap.ini"); } else { $strReturn .= "Failed to copy the browscap file to the project folder\n"; } } else { $strReturn .= "Browscap cache file already existing\n"; } return $strReturn; }
/** * Imports the given dump * * @param string $strFilename * * @return bool */ public function importDb($strFilename) { if (!$this->bitConnected) { $this->dbconnect(); } //gz file? $bitGzip = false; if (substr($strFilename, -3) == ".gz") { $bitGzip = true; //try to decompress $objGzip = new class_gzip(); try { if ($objGzip->decompressFile(_projectpath_ . "/dbdumps/" . $strFilename)) { $strFilename = substr($strFilename, 0, strlen($strFilename) - 3); } else { class_logger::getInstance(class_logger::DBLOG)->addLogRow("Failed to decompress (gzip) the file " . basename($strFilename) . "", class_logger::$levelWarning); return false; } } catch (class_exception $objExc) { $objExc->processException(); return false; } } $bitImport = $this->objDbDriver->dbImport(_projectpath_ . "/dbdumps/" . $strFilename); //Delete source unzipped file? if ($bitGzip) { $objFilesystem = new class_filesystem(); $objFilesystem->fileDelete(_projectpath_ . "/dbdumps/" . $strFilename); } if ($bitImport) { class_logger::getInstance(class_logger::DBLOG)->addLogRow("DB-DUMP " . $strFilename . " was restored", class_logger::$levelWarning); } else { class_logger::getInstance(class_logger::DBLOG)->addLogRow("Error restoring DB-DUMP " . $strFilename, class_logger::$levelError); } return $bitImport; }