• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AEUtilLogger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中AEUtilLogger的典型用法代码示例。如果您正苦于以下问题:PHP AEUtilLogger类的具体用法?PHP AEUtilLogger怎么用?PHP AEUtilLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AEUtilLogger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _run

 /**
  * Implements the _run() abstract method
  */
 function _run()
 {
     if ($this->getState() == 'postrun') {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Already finished");
         $this->setStep('');
         $this->setSubstep('');
     } else {
         $this->setState('running');
     }
     // Try to step the archiver
     $archive = AEFactory::getArchiverEngine();
     $ret = $archive->transformJPA($this->offset);
     // Error propagation
     $this->propagateFromObject($archive);
     if ($ret !== false && $archive->getError() == '') {
         $this->offset = $ret['offset'];
         $this->setStep($ret['filename']);
     }
     // Check for completion
     if ($ret['done']) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . ":: archive is initialized");
         $this->setState('finished');
     }
     // Calculate percentage
     $total_size = $ret['filesize'];
     if ($total_size > 0) {
         $this->progress = $this->offset / $total_size;
     }
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:32,代码来源:installer.php


示例2: processPart

 public function processPart($absolute_filename)
 {
     // Retrieve engine configuration data
     $config = AEFactory::getConfiguration();
     $address = trim($config->get('engine.postproc.email.address', ''));
     $subject = $config->get('engine.postproc.email.subject', '0');
     // Sanity checks
     if (empty($address)) {
         $this->setError('You have not set up a recipient\'s email address for the backup files');
         return false;
     }
     // Send the file
     $basename = basename($absolute_filename);
     AEUtilLogger::WriteLog(_AE_LOG_INFO, "Preparing to email {$basename} to {$address}");
     if (empty($subject)) {
         $subject = JText::_('AKEEBA_DEFAULT_EMAIL_SUBJECT');
     }
     $body = "Emailing {$basename}";
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Subject: {$subject}");
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Body: {$body}");
     $result = AEPlatform::getInstance()->send_email($address, $subject, $body, $absolute_filename);
     // Return the result
     if ($result !== true) {
         // An error occured
         $this->setError($result);
         // Notify that we failed
         return false;
     } else {
         // Return success
         AEUtilLogger::WriteLog(_AE_LOG_INFO, "Email sent successfully");
         return true;
     }
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:33,代码来源:email.php


示例3: _prepare

 protected function _prepare()
 {
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Processing parameters");
     // Get the DB connection parameters
     if (is_array($this->_parametersArray)) {
         $driver = array_key_exists('driver', $this->_parametersArray) ? $this->_parametersArray['driver'] : 'mysql';
         $host = array_key_exists('host', $this->_parametersArray) ? $this->_parametersArray['host'] : '';
         $port = array_key_exists('port', $this->_parametersArray) ? $this->_parametersArray['port'] : '';
         $username = array_key_exists('username', $this->_parametersArray) ? $this->_parametersArray['username'] : '';
         $username = array_key_exists('user', $this->_parametersArray) ? $this->_parametersArray['user'] : $username;
         $password = array_key_exists('password', $this->_parametersArray) ? $this->_parametersArray['password'] : '';
         $database = array_key_exists('database', $this->_parametersArray) ? $this->_parametersArray['database'] : '';
         $prefix = array_key_exists('prefix', $this->_parametersArray) ? $this->_parametersArray['prefix'] : '';
     }
     $options = array('driver' => $driver, 'host' => $host . ($port != '' ? ':' . $port : ''), 'user' => $username, 'password' => $password, 'database' => $database, 'prefix' => is_null($prefix) ? '' : $prefix);
     $db = AEFactory::getDatabase($options);
     $driverType = $db->getDriverType();
     $className = 'AEDumpNative' . ucfirst($driverType);
     // Check if we have a native dump driver
     if (!class_exists($className, true)) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Native database dump engine {$className} not found; trying Reverse Engineering instead");
         // Native driver nor found, I will try falling back to reverse engineering
         $className = 'AEDumpReverse' . ucfirst($driverType);
     }
     if (!class_exists($className, true)) {
         $this->setState('error', 'Akeeba Engine does not have a native dump engine for ' . $driverType . ' databases');
     } else {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Instanciating new native database dump engine {$className}");
         $this->_engine = new $className();
         $this->_engine->setup($this->_parametersArray);
         $this->_engine->callStage('_prepare');
         $this->setState($this->_engine->getState(), $this->_engine->getError());
     }
 }
开发者ID:01J,项目名称:topm,代码行数:34,代码来源:native.php


示例4: download

 public function download()
 {
     AEPlatform::getInstance()->load_configuration(AEPlatform::getInstance()->get_active_profile());
     $tag = JRequest::getCmd('tag', null);
     $filename = AEUtilLogger::logName($tag);
     @ob_end_clean();
     // In case some braindead plugin spits its own HTML
     header("Cache-Control: no-cache, must-revalidate");
     // HTTP/1.1
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     header("Content-Description: File Transfer");
     header('Content-Type: text/plain');
     header('Content-Disposition: attachment; filename="Akeeba Backup Debug Log.txt"');
     echo "WARNING: Do not copy and paste lines from this file!\r\n";
     echo "You are supposed to ZIP and attach it in your support forum post.\r\n";
     echo "If you fail to do so, your support request will receive minimal priority.\r\n";
     echo "\r\n";
     echo "--- START OF RAW LOG --\r\n";
     @readfile($filename);
     // The at sign is necessary to skip showing PHP errors if the file doesn't exist or isn't readable for some reason
     echo "--- END OF RAW LOG ---\r\n";
     flush();
     JFactory::getApplication()->close();
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:25,代码来源:log.php


示例5: updateMultipart

 /**
  * Updates the multipart status of the current backup attempt's statistics record
  *
  * @param int $multipart The new multipart status
  */
 public function updateMultipart($multipart)
 {
     if ($this->multipart_lock) {
         return;
     }
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Updating multipart status to ' . $multipart);
     // Cache this change and commit to db only after the backup is done, or failed
     $registry = AEFactory::getConfiguration();
     $registry->set('volatile.statistics.multipart', $multipart);
 }
开发者ID:01J,项目名称:topm,代码行数:15,代码来源:statistics.php


示例6: echoRawLog

 public function echoRawLog()
 {
     $tag = $this->getState('tag', '');
     echo "WARNING: Do not copy and paste lines from this file!\r\n";
     echo "You are supposed to ZIP and attach it in your support forum post.\r\n";
     echo "If you fail to do so, your support request will receive minimal priority.\r\n";
     echo "\r\n";
     echo "--- START OF RAW LOG --\r\n";
     @readfile(AEUtilLogger::logName($tag));
     // The at sign is necessary to skip showing PHP errors if the file doesn't exist or isn't readable for some reason
     echo "--- END OF RAW LOG ---\r\n";
 }
开发者ID:01J,项目名称:topm,代码行数:12,代码来源:logs.php


示例7: runAnalysis

 public function runAnalysis()
 {
     $ret_array = array();
     $ajaxTask = $this->getState('ajax');
     $log = $this->getState('log');
     switch ($ajaxTask) {
         case 'start':
             $tag = 'alice';
             AliceUtilLogger::WriteLog(true);
             AliceUtilLogger::WriteLog(_AE_LOG_INFO, 'Starting analysis');
             AliceCoreKettenrad::reset(array('maxrun' => 0));
             AliceUtilTempvars::reset($tag);
             $kettenrad = AliceCoreKettenrad::load($tag);
             $options = array('logToAnalyze' => AEUtilLogger::logName($log));
             $kettenrad->setup($options);
             $kettenrad->tick();
             if ($kettenrad->getState() != 'running') {
                 $kettenrad->tick();
             }
             $ret_array = $kettenrad->getStatusArray();
             $kettenrad->resetWarnings();
             // So as not to have duplicate warnings reports
             AliceCoreKettenrad::save($tag);
             break;
         case 'step':
             $tag = 'alice';
             $kettenrad = AliceCoreKettenrad::load($tag);
             $kettenrad->tick();
             $ret_array = $kettenrad->getStatusArray();
             $kettenrad->resetWarnings();
             // So as not to have duplicate warnings reports
             AliceCoreKettenrad::save($tag);
             if ($ret_array['HasRun'] == 1) {
                 // Let's get tests result
                 $config = AliceFactory::getConfiguration();
                 $feedback = $config->get('volatile.alice.feedback');
                 $ret_array['Results'] = json_encode($feedback);
                 // Clean up
                 AliceFactory::nuke();
                 AliceUtilTempvars::reset($tag);
             }
             break;
         default:
             break;
     }
     return $ret_array;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:47,代码来源:alices.php


示例8: onKeyDown

}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;

// Disable CTRL-C, CTRL-V
function onKeyDown() {
	return false;
}

document.onkeydown = onKeyDown;
</script>
<?php 
// -- Get the log's file name
$tag = JRequest::getCmd('tag', 'null');
$logName = AEUtilLogger::logName($tag);
// Load JFile class
jimport('joomla.filesystem.file');
@ob_end_clean();
if (!JFile::exists($logName)) {
    // Oops! The log doesn't exist!
    echo '<p>' . JText::_('LOG_ERROR_LOGFILENOTEXISTS') . '</p>';
    return;
} else {
    // Allright, let's load and render it
    $fp = fopen($logName, "rt");
    if ($fp === FALSE) {
        // Oops! The log isn't readable?!
        echo '<p>' . JText::_('LOG_ERROR_UNREADABLE') . '</p>';
        return;
    }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:31,代码来源:raw.php


示例9: AkeebaTimeoutTrap

function AkeebaTimeoutTrap()
{
    if (connection_status() >= 2) {
        AEUtilLogger::WriteLog(_AE_LOG_ERROR, 'Akeeba Engine has timed out');
    }
}
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:6,代码来源:factory.php


示例10: enforce_min_exec_time

 /**
  * Enforce the minimum execution time
  *
  * @param    bool $log Should I log what I'm doing? Default is true.
  */
 public function enforce_min_exec_time($log = true)
 {
     // Try to get a sane value for PHP's maximum_execution_time INI parameter
     if (@function_exists('ini_get')) {
         $php_max_exec = @ini_get("maximum_execution_time");
     } else {
         $php_max_exec = 10;
     }
     if ($php_max_exec == "" || $php_max_exec == 0) {
         $php_max_exec = 10;
     }
     // Decrease $php_max_exec time by 500 msec we need (approx.) to tear down
     // the application, as well as another 500msec added for rounding
     // error purposes. Also make sure this is never gonna be less than 0.
     $php_max_exec = max($php_max_exec * 1000 - 1000, 0);
     // Get the "minimum execution time per step" Akeeba Backup configuration variable
     $configuration = AEFactory::getConfiguration();
     $minexectime = $configuration->get('akeeba.tuning.min_exec_time', 0);
     if (!is_numeric($minexectime)) {
         $minexectime = 0;
     }
     // Make sure we are not over PHP's time limit!
     if ($minexectime > $php_max_exec) {
         $minexectime = $php_max_exec;
     }
     // Get current running time
     $elapsed_time = $this->getRunningTime() * 1000;
     // Only run a sleep delay if we haven't reached the minexectime execution time
     if ($minexectime > $elapsed_time && $elapsed_time > 0) {
         $sleep_msec = $minexectime - $elapsed_time;
         if (function_exists('usleep')) {
             if ($log) {
                 AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sleeping for {$sleep_msec} msec, using usleep()");
             }
             usleep(1000 * $sleep_msec);
         } elseif (function_exists('time_nanosleep')) {
             if ($log) {
                 AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sleeping for {$sleep_msec} msec, using time_nanosleep()");
             }
             $sleep_sec = floor($sleep_msec / 1000);
             $sleep_nsec = 1000000 * ($sleep_msec - $sleep_sec * 1000);
             time_nanosleep($sleep_sec, $sleep_nsec);
         } elseif (function_exists('time_sleep_until')) {
             if ($log) {
                 AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sleeping for {$sleep_msec} msec, using time_sleep_until()");
             }
             $until_timestamp = time() + $sleep_msec / 1000;
             time_sleep_until($until_timestamp);
         } elseif (function_exists('sleep')) {
             $sleep_sec = ceil($sleep_msec / 1000);
             if ($log) {
                 AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sleeping for {$sleep_sec} seconds, using sleep()");
             }
             sleep($sleep_sec);
         }
     } elseif ($elapsed_time > 0) {
         // No sleep required, even if user configured us to be able to do so.
         if ($log) {
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "No need to sleep; execution time: {$elapsed_time} msec; min. exec. time: {$minexectime} msec");
         }
     }
 }
开发者ID:01J,项目名称:topm,代码行数:67,代码来源:timer.php


示例11: _createNewPart

 /**
  * Creates a new archive part
  * @param bool $finalPart Set to true if it is the final part (therefore has the .jps extension)
  */
 private function _createNewPart($finalPart = false)
 {
     // Push the previous part if we have to post-process it immediately
     $configuration = AEFactory::getConfiguration();
     if ($configuration->get('engine.postproc.common.after_part', 0)) {
         $this->finishedPart[] = $this->_dataFileName;
     }
     $this->_totalFragments++;
     $this->_currentFragment = $this->_totalFragments;
     if ($finalPart) {
         $this->_dataFileName = $this->_dataFileNameBase . '.jps';
     } else {
         $this->_dataFileName = $this->_dataFileNameBase . '.j' . sprintf('%02d', $this->_currentFragment);
     }
     AEUtilLogger::WriteLog(_AE_LOG_INFO, 'Creating new JPS part #' . $this->_currentFragment . ', file ' . $this->_dataFileName);
     // Inform that we have chenged the multipart number
     $statistics = AEFactory::getStatistics();
     $statistics->updateMultipart($this->_totalFragments);
     // Try to remove any existing file
     @unlink($this->_dataFileName);
     // Touch the new file
     $result = @touch($this->_dataFileName);
     if (function_exists('chmod')) {
         chmod($this->_dataFileName, 0666);
     }
     return $result;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:31,代码来源:jps.php


示例12: pack_files

 /**
  * Try to pack some files in the $file_list, restraining ourselves not to reach the max
  * number of files or max fragment size while doing so. If this process is over and we are
  * left without any more files, reset $done_scanning to false in order to instruct the class
  * to scan for more files.
  *
  * @return bool True if there were files packed, false otherwise (empty filelist)
  */
 private function pack_files()
 {
     // Get a reference to the archiver and the timer classes
     $archiver = AEFactory::getArchiverEngine();
     $timer = AEFactory::getTimer();
     $configuration = AEFactory::getConfiguration();
     // If post-processing after part creation is enabled, make sure we do post-process each part before moving on
     if ($configuration->get('engine.postproc.common.after_part', 0)) {
         if (!empty($archiver->finishedPart)) {
             $filename = array_shift($archiver->finishedPart);
             AEUtilLogger::WriteLog(_AE_LOG_INFO, 'Preparing to post process ' . basename($filename));
             $post_proc = AEFactory::getPostprocEngine();
             $result = $post_proc->processPart($filename);
             $this->propagateFromObject($post_proc);
             if ($result === false) {
                 $this->setWarning('Failed to process file ' . basename($filename));
             } else {
                 AEUtilLogger::WriteLog(_AE_LOG_INFO, 'Successfully processed file ' . basename($filename));
             }
             // Should we delete the file afterwards?
             if ($configuration->get('engine.postproc.common.delete_after', false) && $post_proc->allow_deletes && $result !== false) {
                 AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Deleting already processed file ' . basename($filename));
                 AEPlatform::getInstance()->unlink($filename);
             }
             if ($post_proc->break_after && $result !== false) {
                 $configuration->set('volatile.breakflag', true);
                 return true;
             }
             // This is required to let the backup continue even after a post-proc failure
             $this->resetErrors();
             $this->setState('running');
         }
     }
     // If the archiver has work to do, make sure it finished up before continuing
     if ($configuration->get('volatile.engine.archiver.processingfile', false)) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Continuing file packing from previous step");
         $result = $archiver->addFile('', '', '');
         $this->propagateFromObject($archiver);
         if ($this->getError()) {
             return false;
         }
         // If that was the last step, mark a file done
         if (!$configuration->get('volatile.engine.archiver.processingfile', false)) {
             $this->progressMarkFileDone();
         }
     }
     // Did it finish, or does it have more work to do?
     if ($configuration->get('volatile.engine.archiver.processingfile', false)) {
         // More work to do. Let's just tell our parent that we finished up successfully.
         return true;
     }
     // Normal file backup loop; we keep on processing the file list, packing files as we go.
     if (count($this->file_list) == 0) {
         // No files left to pack -- This should never happen! We catch this condition at the end of this method!
         $this->done_scanning = false;
         $this->progressMarkFolderDone();
         return false;
     } else {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Packing files");
         $packedSize = 0;
         $numberOfFiles = 0;
         list($usec, $sec) = explode(" ", microtime());
         $opStartTime = (double) $usec + (double) $sec;
         while (count($this->file_list) > 0) {
             $file = @array_shift($this->file_list);
             $size = 0;
             if (file_exists($file)) {
                 $size = @filesize($file);
             }
             // Anticipatory file size algorithm
             if ($numberOfFiles > 0 && $size > AELargeFileThreshold) {
                 if (!AEFactory::getConfiguration()->get('akeeba.tuning.nobreak.beforelargefile', 0)) {
                     // If the file is bigger than the big file threshold, break the step
                     // to avoid potential timeouts
                     $this->setBreakFlag();
                     AEUtilLogger::WriteLog(_AE_LOG_INFO, "Breaking step _before_ large file: " . $file . " - size: " . $size);
                     // Push the file back to the list.
                     array_unshift($this->file_list, $file);
                     // Mark that we are not done packing files
                     $this->done_scanning = true;
                     return true;
                 }
             }
             // Proactive potential timeout detection
             // Rough estimation of packing speed in bytes per second
             list($usec, $sec) = explode(" ", microtime());
             $opEndTime = (double) $usec + (double) $sec;
             if ($opEndTime - $opStartTime == 0) {
                 $_packSpeed = 0;
             } else {
                 $_packSpeed = $packedSize / ($opEndTime - $opStartTime);
             }
//.........这里部分代码省略.........
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:101,代码来源:pack.php


示例13: deleteTempFiles

 /**
  * Deletes all temporary files
  */
 static function deleteTempFiles()
 {
     $configuration = AEFactory::getConfiguration();
     $tempFiles = $configuration->get('volatile.tempfiles', false);
     if ($tempFiles === false) {
         $tempFiles = array();
     } else {
         $tempFiles = @unserialize($tempFiles);
     }
     $fileName = null;
     if (!empty($tempFiles)) {
         foreach ($tempFiles as $fileName) {
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Removing temporary file {$fileName}");
             $file = $configuration->get('akeeba.basic.output_directory') . '/' . $fileName;
             $platform = strtoupper(PHP_OS);
             if (substr($platform, 0, 6) == 'CYGWIN' || substr($platform, 0, 3) == 'WIN') {
                 // On Windows we have to chwon() the file first to make it owned by Nobody
                 @chown($file, 600);
             }
             $ret = @self::nullifyAndDelete($file);
         }
     }
     $tempFiles = array();
     $configuration->set('volatile.tempfiles', serialize($tempFiles));
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:28,代码来源:tempfiles.php


示例14: _addFile

 /**
  * The most basic file transaction: add a single entry (file or directory) to
  * the archive.
  *
  * @param bool $isVirtual If true, the next parameter contains file data instead of a file name
  * @param string $sourceNameOrData Absolute file name to read data from or the file data itself is $isVirtual is true
  * @param string $targetName The (relative) file name under which to store the file in the archive
  * @return True on success, false otherwise
  */
 protected function _addFile($isVirtual, &$sourceNameOrData, $targetName)
 {
     if (!is_object($this->zip)) {
         return false;
     }
     if (!$isVirtual) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "AEArchiverZipnative :: Adding {$sourceNameOrData}");
         if (is_dir($sourceNameOrData)) {
             $result = $this->zip->addEmptyDir($targetName);
         } else {
             $this->runningSum += filesize($sourceNameOrData);
             $result = $this->zip->addFile($sourceNameOrData, $targetName);
         }
     } else {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '  Virtual add:' . $targetName . ' (' . strlen($sourceNameOrData) . ')');
         $this->runningSum += strlen($sourceNameOrData);
         if (empty($sourceNameOrData)) {
             $result = $this->zip->addEmptyDir($targetName);
         } else {
             $result = $this->zip->addFromString($targetName, $sourceNameOrData);
         }
     }
     $this->zip->close();
     $this->__bootstrap_code();
     return true;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:35,代码来源:zipnative.php


示例15: transformJPA

 /**
  * Transforms a JPA archive (containing an installer) to the native archive format
  * of the class. It actually extracts the source JPA in memory and instructs the
  * class to include each extracted file.
  *
  * @param   integer  $index  The index in the source JPA archive's list currently in use
  * @param   integer  $offset The source JPA archive's offset to use
  *
  * @return  boolean  False if an error occurred, true otherwise
  */
 public final function transformJPA($index, $offset)
 {
     static $totalSize = 0;
     // Do we have to open the file?
     if (!$this->_xform_fp) {
         // Get the source path
         $registry = AEFactory::getConfiguration();
         $embedded_installer = $registry->get('akeeba.advanced.embedded_installer');
         // Fetch the name of the installer image
         $installerDescriptors = AEUtilInihelper::getInstallerList();
         $xform_source = AEPlatform::getInstance()->get_installer_images_path() . DIRECTORY_SEPARATOR . 'foobar.jpa';
         // We need this as a "safe fallback"
         if (array_key_exists($embedded_installer, $installerDescriptors)) {
             $packages = $installerDescriptors[$embedded_installer]['package'];
             if (empty($packages)) {
                 // No installer package specified. Pretend we are done!
                 $retArray = array("filename" => '', "data" => '', "index" => 0, "offset" => 0, "skip" => false, "done" => true, "filesize" => 0);
                 return $retArray;
             } else {
                 $packages = explode(',', $packages);
                 $totalSize = 0;
                 $pathPrefix = AEPlatform::getInstance()->get_installer_images_path() . DIRECTORY_SEPARATOR;
                 foreach ($packages as $package) {
                     $filePath = $pathPrefix . $package;
                     $totalSize += (int) @filesize($filePath);
                 }
                 if (count($packages) < $index) {
                     $this->setError(__CLASS__ . ":: Installer package index {$index} not found for embedded installer {$embedded_installer}");
                     return false;
                 }
                 $package = $packages[$index];
                 // A package is specified, use it!
                 $xform_source = $pathPrefix . $package;
             }
         }
         // 2.3: Try to use sane default if the indicated installer doesn't exist
         if (!file_exists($xform_source) && basename($xform_source) != 'angie.jpa') {
             if ($index == 0) {
                 $this->setWarning(__CLASS__ . ":: Selected embedded installer not found, using ANGIE instead");
                 $xform_source = dirname($xform_source) . '/angie.jpa';
             } else {
                 $this->setError(__CLASS__ . ":: Installer package {$xform_source} not found.");
                 return false;
             }
         }
         // Try opening the file
         if (file_exists($xform_source)) {
             $this->_xform_fp = @fopen($xform_source, 'r');
             if ($this->_xform_fp === false) {
                 $this->setError(__CLASS__ . ":: Can't seed archive with installer package " . $xform_source);
                 return false;
             }
         } else {
             $this->setError(__CLASS__ . ":: Installer package " . $xform_source . " does not exist!");
             return false;
         }
     }
     $headerDataLength = 0;
     if (!$offset) {
         // First run detected!
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Initializing with JPA package ' . $xform_source);
         $offset = 0;
         // Skip over the header and check no problem exists
         $offset = $this->_xformReadHeader();
         if ($offset === false) {
             $this->setError('JPA package file was not read');
             return false;
             // Oops! The package file doesn't exist or is corrupt
         }
         $headerDataLength = $offset;
     }
     $ret = $this->_xformExtract($offset);
     $ret['index'] = $index;
     if (is_array($ret)) {
         $ret['chunkProcessed'] = $headerDataLength + $ret['offset'] - $offset;
         $offset = $ret['offset'];
         if (!$ret['skip'] && !$ret['done']) {
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '  Adding ' . $ret['filename'] . '; Next offset:' . $offset);
             $this->addVirtualFile($ret['filename'], '', $ret['data']);
             if ($this->getError()) {
                 return false;
             }
         } elseif ($ret['done']) {
             $registry = AEFactory::getConfiguration();
             $embedded_installer = $registry->get('akeeba.advanced.embedded_installer');
             $installerDescriptors = AEUtilInihelper::getInstallerList();
             $packages = $installerDescriptors[$embedded_installer]['package'];
             $packages = explode(',', $packages);
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '  Done with package ' . $packages[$index]);
             if (count($packages) > $index + 1) {
//.........这里部分代码省略.........
开发者ID:Nileshsaini,项目名称:teamhead,代码行数:101,代码来源:archiver.php


示例16: get_remote_quotas

 /**
  * Applies the size and count quotas
  *
  * @return bool
  */
 private function get_remote_quotas()
 {
     // Get all records with a remote filename
     $allRecords = AEPlatform::getInstance()->get_valid_remote_records();
     // Bail out if no records found
     if (empty($allRecords)) {
         return array();
     }
     // Try to find the files to be deleted due to quota settings
     $statistics = AEFactory::getStatistics();
     $latestBackupId = $statistics->getId();
     // Filter out the current record
     $temp = array();
     foreach ($allRecords as $item) {
         if ($item['id'] == $latestBackupId) {
             continue;
         }
         $item['files'] = $this->get_remote_files($item['remote_filename'], $item['multipart']);
         $temp[] = $item;
     }
     $allRecords = $temp;
     // Bail out if only the current backup was included in the list
     if (count($allRecords) == 0) {
         return array();
     }
     // Get quota values
     $registry = AEFactory::getConfiguration();
     $countQuota = $registry->get('akeeba.quota.count_quota');
     $sizeQuota = $registry->get('akeeba.quota.size_quota');
     $useCountQuotas = $registry->get('akeeba.quota.enable_count_quota');
     $useSizeQuotas = $registry->get('akeeba.quota.enable_size_quota');
     $useDayQuotas = $registry->get('akeeba.quota.maxage.enable');
     $daysQuota = $registry->get('akeeba.quota.maxage.maxdays');
     $preserveDay = $registry->get('akeeba.quota.maxage.keepday');
     $leftover = array();
     $ret = array();
     $killids = array();
     if ($useDayQuotas) {
         $killDatetime = new DateTime();
         $killDatetime->modify('-' . $daysQuota . ($daysQuota == 1 ? ' day' : ' days'));
         $killTS = $killDatetime->format('U');
         foreach ($allRecords as $def) {
             $backupstart = new DateTime($def['backupstart']);
             $backupTS = $backupstart->format('U');
             $backupDay = $backupstart->format('d');
             // Is this on a preserve day?
             if ($preserveDay > 0) {
                 if ($preserveDay == $backupDay) {
                     $leftover[] = $def;
                     continue;
                 }
             }
             // Otherwise, check the timestamp
             if ($backupTS < $killTS) {
                 $ret[] = $def['files'];
                 $killids[] = $def['id'];
             } else {
                 $leftover[] = $def;
             }
         }
     }
     // Do we need to apply count quotas?
     if ($useCountQuotas && $countQuota >= 1 && !$useDayQuotas) {
         $countQuota--;
         // Are there more files than the quota limit?
         if (!(count($allRecords) > $countQuota)) {
             // No, effectively skip the quota checking
             $leftover = $allRecords;
         } else {
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Processing remote count quotas");
             // Yes, apply the quota setting.
             $totalRecords = count($allRecords);
             for ($count = 0; $count <= $totalRecords; $count++) {
                 $def = array_pop($allRecords);
                 if (count($leftover) >= $countQuota) {
                     $ret[] = $def['files'];
                     $killids[] = $def['id'];
                 } else {
                     $leftover[] = $def;
                 }
             }
             unset($allRecords);
         }
     } else {
         // No count quotas are applied
         $leftover = $allRecords;
     }
     // Do we need to apply size quotas?
     if ($useSizeQuotas && $sizeQuota > 0 && count($leftover) > 0 && !$useDayQuotas) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Processing remote size quotas");
         // OK, let's start counting bytes!
         $runningSize = 0;
         while (count($leftover) > 0) {
             // Each time, remove the last element of the backup array and calculate
             // running size. If it's over the limit, add the archive to the $ret array.
//.........这里部分代码省略.........
开发者ID:01J,项目名称:topm,代码行数:101,代码来源:finalization.php


示例17: processPart

 public function processPart($absolute_filename, $upload_as = null)
 {
     // Retrieve engine configuration data
     $config = AEFactory::getConfiguration();
     $accesskey = trim($config->get('engine.postproc.googlestorage.accesskey', ''));
     $secret = trim($config->get('engine.postproc.googlestorage.secretkey', ''));
     $usessl = $config->get('engine.postproc.googlestorage.usessl', 0) == 0 ? false : true;
     $bucket = $config->get('engine.postproc.googlestorage.bucket', '');
     $directory = $config->get('volatile.postproc.directory', null);
     $lowercase = $config->get('engine.postproc.googlestorage.lowercase', 1);
     if (empty($directory)) {
         $directory = $config->get('engine.postproc.googlestorage.directory', 0);
     }
     // Sanity checks
     if (empty($accesskey)) {
         $this->setError('You have not set up your Google Storage Access Key');
         return false;
     }
     if (empty($secret)) {
         $this->setError('You have not set up your Google Storage Secret Key');
         return false;
     }
     if (empty($bucket)) {
         $this->setError('You have not set up your Google Storage Bucket');
         return false;
     } else {
         // Remove any slashes from the bucket
         $bucket = str_replace('/', '', $bucket);
         if ($lowercase) {
             $bucket = strtolower($bucket);
         }
     }
     // Create an S3 instance with the required credentials
     $s3 = AEUtilAmazons3::getInstance($accesskey, $secret, $usessl);
     $s3->defaultHost = 'commondatastorage.googleapis.com';
     // If we are here, we'll have to start uploading the file. Let's prepare ourselves for that.
     // Fix the directory name, if required
     if (!empty($directory)) {
         $directory = trim($directory);
         $directory = ltrim(AEUtilFilesystem::TranslateWinPath($directory), '/');
     } else {
         $directory = '';
     }
     // Parse tags
     $directory = AEUtilFilesystem::replace_archive_name_variables($directory);
     $config->set('volatile.postproc.directory', $directory);
     // Calculate relative remote filename
     $filename = empty($upload_as) ? basename($absolute_filename) : $upload_as;
     if (!empty($directory) && $directory != '/') {
         $filename = $directory . '/' . $filename;
     }
     // Store the absolute remote path in the class property
     $this->remote_path = $filename;
     // Do we have to upload in one go or do a multipart upload instead?
     $filesize = @filesize($absolute_filename);
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Google Storage -- Uploading " . basename($absolute_filename));
     // Legacy single part uploads
     $result = $s3->putObject(AEUtilAmazons3::inputFile($absolute_filename, false), $bucket, $filename, AEUtilAmazons3::ACL_BUCKET_OWNER_FULL_CONTROL, array(), array());
     // Return the result
     $this->propagateFromObject($s3);
     return $result;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:62,代码来源:googlestorage.php


示例18: reset

 /**
  * Resets the Kettenrad state, wipping out any pending backups and/or stale
  * temporary data.
  *
  * @param array $config Configuration parameters for the reset operation
  */
 public static function reset($config = array())
 {
     $default_config = array('global' => true, 'log' => false, 'maxrun' => 0);
     $config = (object) array_merge($default_config, $config);
     // Pause logging if so desired
     if (!$config->log) {
         AEUtilLogger::WriteLog(false, '');
     }
     $tag = null;
     if (!$config->global) {
         // If we're not resetting globally, get a list of running backups per tag
         $tag = AEPlatform::getInstance()->get_backup_origin();
     }
     // Cache the factory before proceeding
     $factory = AEFactory::serialize();
     $runningList = AEPlatform::getInstance()->get_running_backups($tag);
     // Origins we have to clean
     $origins = array(AEPlatform::getInstance()->get_backup_origin());
     // 1. Detect failed backups
     if (is_array($runningList) && !empty($runningList)) {
         // The current timestamp
         $now = time();
         // Mark running backups as failed
         foreach ($runningList as $running) {
             if (empty($tag)) {
                 // Check the timestamp of the log file to decide if it's stuck,
                 // but only if a tag is not set
                 $tstamp = @filemtime(AEUtilLogger::logName($running['origin']));
                 if ($tstamp !== false) {
                     // We can only check the timestamp if it's returned. If not, we assume the backup is stale
                     $difference = abs($now - $tstamp);
                     // Backups less than 3 minutes old are not considered stale
                     if ($difference < $config->maxrun) {
                         continue;
                     }
                 }
             }
             $filenames = AEUtilStatistics::get_all_filenames($running, false);
             // Process if there are files to delete...
             if (!is_null($filenames)) {
                 // Delete the failed backup's archive, if exists
                 foreach ($filenames as $failedArchive) {
                     AEPlatform::getInstance()->unlink($failedArchive);
                 }
             }
             // Mark the backup failed
             $running['status'] = 'fail';
             $running['multipart'] = 0;
             $dummy = null;
             AEPlatform::getInstance()->set_or_update_statistics($running['id'], $running, $dummy);
             $origins[] = $running['origin'];
         }
     }
     if (!empty($origins)) {
         $origins = array_unique($origins);
         foreach ($origins as $tag) {
             AECoreKettenrad::load($tag);
             // Remove temporary files
             AEUtilTempfiles::deleteTempFiles();
             // Delete any stale temporary data
             AEUtilTempvars::reset($tag);
         }
     }
     // Reload the factory
     AEFactory::unserialize($factory);
     unset($factory);
     // Unpause logging if it was previously paused
     if (!$config->log) {
         AEUtilLogger::WriteLog(true, '');
     }
 }
开发者ID:greyhat777,项目名称:vuslinterliga,代码行数:77,代码来源:kettenrad.php


示例19: reverse_engineer_views

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AError类代码示例发布时间:2022-05-23
下一篇:
PHP AEUtilFilesystem类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap