当前位置: 首页>>代码示例>>PHP>>正文


PHP Factory::getFilesystemTools方法代码示例

本文整理汇总了PHP中Akeeba\Engine\Factory::getFilesystemTools方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getFilesystemTools方法的具体用法?PHP Factory::getFilesystemTools怎么用?PHP Factory::getFilesystemTools使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Akeeba\Engine\Factory的用法示例。


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

示例1: execute

 /**
  * Execute the JSON API task
  *
  * @param   array $parameters The parameters to this task
  *
  * @return  mixed
  *
  * @throws  \RuntimeException  In case of an error
  */
 public function execute(array $parameters = array())
 {
     // Get the passed configuration values
     $defConfig = array('profile' => -1, 'engineconfig' => array());
     $defConfig = array_merge($defConfig, $parameters);
     $profile = (int) $defConfig['profile'];
     $data = $defConfig['engineconfig'];
     if (empty($profile)) {
         throw new \RuntimeException('Invalid profile ID', 404);
     }
     // Forbid stupidly selecting the site's root as the output or temporary directory
     if (array_key_exists('akeeba.basic.output_directory', $data)) {
         $folder = $data['akeeba.basic.output_directory'];
         $folder = Factory::getFilesystemTools()->translateStockDirs($folder, true, true);
         $check = Factory::getFilesystemTools()->translateStockDirs('[SITEROOT]', true, true);
         if ($check == $folder) {
             $data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]';
         }
     }
     // Merge it
     $config = Factory::getConfiguration();
     $protectedKeys = $config->getProtectedKeys();
     $config->resetProtectedKeys();
     $config->mergeArray($data, false, false);
     $config->setProtectedKeys($protectedKeys);
     // Save configuration
     return Platform::getInstance()->save_configuration($profile);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:37,代码来源:SaveConfiguration.php

示例2: __construct

 public function __construct()
 {
     $this->object = 'dir';
     $this->subtype = 'inclusion';
     $this->method = 'direct';
     $this->filter_name = 'Libraries';
     // FIXME This filter doesn't work very well on many live hosts. Disabled for now.
     parent::__construct();
     return;
     if (empty($this->filter_name)) {
         $this->filter_name = strtolower(basename(__FILE__, '.php'));
     }
     // Get the saved library path and compare it to the default
     $jlibdir = Platform::getInstance()->get_platform_configuration_option('jlibrariesdir', '');
     if (empty($jlibdir)) {
         if (defined('JPATH_LIBRARIES')) {
             $jlibdir = JPATH_LIBRARIES;
         } elseif (defined('JPATH_PLATFORM')) {
             $jlibdir = JPATH_PLATFORM;
         } else {
             $jlibdir = false;
         }
     }
     if ($jlibdir !== false) {
         $jlibdir = Factory::getFilesystemTools()->TranslateWinPath($jlibdir);
         $defaultLibraries = Factory::getFilesystemTools()->TranslateWinPath(JPATH_SITE . '/libraries');
         if ($defaultLibraries != $jlibdir) {
             // The path differs, add it here
             $this->filter_data['JPATH_LIBRARIES'] = $jlibdir;
         }
     } else {
         $this->filter_data = array();
     }
     parent::__construct();
 }
开发者ID:esorone,项目名称:efcpw,代码行数:35,代码来源:Libraries.php

示例3: scanFolder

 protected function scanFolder($folder, &$position, $forFolders = true, $threshold_key = 'dir', $threshold_default = 50)
 {
     $registry = Factory::getConfiguration();
     // Initialize variables
     $arr = array();
     $false = false;
     if (!is_dir($folder) && !is_dir($folder . '/')) {
         return $false;
     }
     try {
         $di = new \DirectoryIterator($folder);
     } catch (\Exception $e) {
         $this->setWarning('Unreadable directory ' . $folder);
         return $false;
     }
     if (!$di->valid()) {
         $this->setWarning('Unreadable directory ' . $folder);
         return $false;
     }
     if (!empty($position)) {
         $di->seek($position);
         if ($di->key() != $position) {
             $position = null;
             return $arr;
         }
     }
     $counter = 0;
     $maxCounter = $registry->get("engine.scan.large.{$threshold_key}_threshold", $threshold_default);
     while ($di->valid()) {
         if ($di->isDot()) {
             $di->next();
             continue;
         }
         if ($di->isDir() != $forFolders) {
             $di->next();
             continue;
         }
         $ds = $folder == '' || $folder == '/' || @substr($folder, -1) == '/' || @substr($folder, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
         $dir = $folder . $ds . $di->getFilename();
         $data = _AKEEBA_IS_WINDOWS ? Factory::getFilesystemTools()->TranslateWinPath($dir) : $dir;
         if ($data) {
             $counter++;
             $arr[] = $data;
         }
         if ($counter == $maxCounter) {
             break;
         } else {
             $di->next();
         }
     }
     // Determine the new value for the position
     $di->next();
     if ($di->valid()) {
         $position = $di->key() - 1;
     } else {
         $position = null;
     }
     return $arr;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:59,代码来源:Large.php

示例4: __bootstrap_code

 /**
  * Common code which gets called on instance creation or wake-up (unserialization)
  *
  * @codeCoverageIgnore
  *
  * @return  void
  */
 protected function __bootstrap_code()
 {
     if (!defined('AKEEBA_CHUNK')) {
         // Cache chunk override as a constant
         $registry = Factory::getConfiguration();
         $chunk_override = $registry->get('engine.archiver.common.chunk_size', 0);
         define('AKEEBA_CHUNK', $chunk_override > 0 ? $chunk_override : 1048756);
     }
     $this->fsUtils = Factory::getFilesystemTools();
 }
开发者ID:jvhost,项目名称:A-Website,代码行数:17,代码来源:Base.php

示例5: unregisterAndDeleteTempFile

 /**
  * Unregister and delete a temporary file
  *
  * @param   string  $fileName      The filename to unregister and delete
  * @param   bool    $removePrefix  The prefix to remove
  *
  * @return  bool  True on success
  */
 public function unregisterAndDeleteTempFile($fileName, $removePrefix = false)
 {
     $configuration = Factory::getConfiguration();
     if ($removePrefix) {
         $fileName = str_replace(Factory::getFilesystemTools()->TranslateWinPath($configuration->get('akeeba.basic.output_directory')), '', $fileName);
         if (substr($fileName, 0, 1) == '/' || substr($fileName, 0, 1) == '\\') {
             $fileName = substr($fileName, 1);
         }
         if (substr($fileName, -1) == '/' || substr($fileName, -1) == '\\') {
             $fileName = substr($fileName, 0, -1);
         }
     }
     // Make sure this file is registered
     $configuration = Factory::getConfiguration();
     $serialised = $configuration->get('volatile.tempfiles', false);
     $tempFiles = array();
     if ($serialised !== false) {
         $tempFiles = @unserialize($serialised);
     }
     if (!is_array($tempFiles)) {
         return false;
     }
     if (!in_array($fileName, $tempFiles)) {
         return false;
     }
     $file = $configuration->get('akeeba.basic.output_directory') . '/' . $fileName;
     Factory::getLog()->log(LogLevel::DEBUG, "-- Removing temporary file {$fileName}");
     $platform = strtoupper(PHP_OS);
     // TODO What exactly are we doing here? chown won't work on Windows. Huh...?
     if (substr($platform, 0, 6) == 'CYGWIN' || substr($platform, 0, 3) == 'WIN') {
         // On Windows we have to chown() the file first to make it owned by Nobody
         Factory::getLog()->log(LogLevel::DEBUG, "-- Windows hack: chowning {$fileName}");
         @chown($file, 600);
     }
     $result = @$this->nullifyAndDelete($file);
     // Make sure the file is removed before unregistering it
     if (!@file_exists($file)) {
         $aPos = array_search($fileName, $tempFiles);
         if ($aPos !== false) {
             unset($tempFiles[$aPos]);
             $configuration->set('volatile.tempfiles', serialize($tempFiles));
         }
     }
     return $result;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:53,代码来源:TemporaryFiles.php

示例6: saveEngineConfig

 /**
  * Save the engine configuration
  *
  * @return  void
  */
 public function saveEngineConfig()
 {
     $data = $this->getState('engineconfig', array());
     // Forbid stupidly selecting the site's root as the output or temporary directory
     if (array_key_exists('akeeba.basic.output_directory', $data)) {
         $folder = $data['akeeba.basic.output_directory'];
         $folder = Factory::getFilesystemTools()->translateStockDirs($folder, true, true);
         $check = Factory::getFilesystemTools()->translateStockDirs('[SITEROOT]', true, true);
         if ($check == $folder) {
             $data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]';
         }
     }
     // Unprotect the configuration and merge it
     $config = Factory::getConfiguration();
     $protectedKeys = $config->getProtectedKeys();
     $config->resetProtectedKeys();
     $config->mergeArray($data, false, false);
     $config->setProtectedKeys($protectedKeys);
     // Save configuration
     Platform::getInstance()->save_configuration();
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:26,代码来源:Configuration.php

示例7: initialiseWithProfileParameters

 /**
  * Initialise the logger properties with parameters from the backup profile and the platform
  *
  * @return  void
  */
 protected function initialiseWithProfileParameters()
 {
     // Get the site's translated and untranslated root
     $this->site_root_untranslated = Platform::getInstance()->get_site_root();
     $this->site_root = Factory::getFilesystemTools()->TranslateWinPath($this->site_root_untranslated);
     // Load the registry and fetch log level
     $registry = Factory::getConfiguration();
     $this->configuredLoglevel = $registry->get('akeeba.basic.log_level');
     $this->configuredLoglevel = $this->configuredLoglevel * 1;
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:15,代码来源:Logger.php

示例8: initialiseConnector

 /**
  * Initialises the Google Drive connector object
  *
  * @return  bool  True on success, false if we cannot proceed
  */
 protected function initialiseConnector()
 {
     // Retrieve engine configuration data
     $config = Factory::getConfiguration();
     $access_token = trim($config->get('engine.postproc.googledrive.access_token', ''));
     $refresh_token = trim($config->get('engine.postproc.googledrive.refresh_token', ''));
     $this->chunked = $config->get('engine.postproc.googledrive.chunk_upload', true);
     $this->chunk_size = $config->get('engine.postproc.googledrive.chunk_upload_size', 10) * 1024 * 1024;
     $this->directory = $config->get('volatile.postproc.directory', null);
     if (empty($this->directory)) {
         $this->directory = $config->get('engine.postproc.googledrive.directory', '');
     }
     // Sanity checks
     if (empty($refresh_token)) {
         $this->setError('You have not linked Akeeba Backup with your Google Drive account');
         return false;
     }
     if (!function_exists('curl_init')) {
         $this->setWarning('cURL is not enabled, please enable it in order to post-process your archives');
         return false;
     }
     // Fix the directory name, if required
     if (!empty($this->directory)) {
         $this->directory = trim($this->directory);
         $this->directory = ltrim(Factory::getFilesystemTools()->TranslateWinPath($this->directory), '/');
     } else {
         $this->directory = '';
     }
     // Parse tags
     $this->directory = Factory::getFilesystemTools()->replace_archive_name_variables($this->directory);
     $config->set('volatile.postproc.directory', $this->directory);
     $this->googleDrive = new ConnectorGoogleDrive($access_token, $refresh_token);
     // Validate the tokens
     Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . '::' . __METHOD__ . " - Validating the Google Drive tokens");
     $pingResult = $this->googleDrive->ping();
     // Save new configuration if there was a refresh
     if ($pingResult['needs_refresh']) {
         Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . '::' . __METHOD__ . " - Google Drive tokens were refreshed");
         $config->set('engine.postproc.googledrive.access_token', $pingResult['access_token'], false);
         $profile_id = Platform::getInstance()->get_active_profile();
         Platform::getInstance()->save_configuration($profile_id);
     }
     return true;
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:49,代码来源:Googledrive.php

示例9: mail_administrators

 /**
  * Sends an email to the administrators
  *
  * @return bool True on success
  */
 protected function mail_administrators()
 {
     $this->setStep('Processing emails to administrators');
     $this->setSubstep('');
     // Skip email for back-end backups
     if (Platform::getInstance()->get_backup_origin() == 'backend') {
         return true;
     }
     $must_email = Platform::getInstance()->get_platform_configuration_option('frontend_email_on_finish', 0) != 0;
     if (!$must_email) {
         return true;
     }
     Factory::getLog()->log(LogLevel::DEBUG, "Preparing to send e-mail to administrators");
     $email = Platform::getInstance()->get_platform_configuration_option('frontend_email_address', '');
     $email = trim($email);
     if (!empty($email)) {
         Factory::getLog()->log(LogLevel::DEBUG, "Using pre-defined list of emails");
         $emails = explode(',', $email);
     } else {
         Factory::getLog()->log(LogLevel::DEBUG, "Fetching list of Super Administrator emails");
         $emails = Platform::getInstance()->get_administrator_emails();
     }
     if (!empty($emails)) {
         Factory::getLog()->log(LogLevel::DEBUG, "Creating email subject and body");
         // Fetch user's preferences
         $subject = trim(Platform::getInstance()->get_platform_configuration_option('frontend_email_subject', ''));
         $body = trim(Platform::getInstance()->get_platform_configuration_option('frontend_email_body', ''));
         // Get the statistics
         $statistics = Factory::getStatistics();
         $stat = $statistics->getRecord();
         $parts = Factory::getStatistics()->get_all_filenames($stat, false);
         $profile_number = Platform::getInstance()->get_active_profile();
         $profile_name = Platform::getInstance()->get_profile_name($profile_number);
         $parts = Factory::getStatistics()->get_all_filenames($stat, false);
         $stat = (object) $stat;
         $num_parts = $stat->multipart;
         // Non-split archives have a part count of 0
         if ($num_parts == 0) {
             $num_parts = 1;
         }
         $parts_list = '';
         if (!empty($parts)) {
             foreach ($parts as $file) {
                 $parts_list .= "\t" . basename($file) . "\n";
             }
         }
         // Get the remote storage status
         $remote_status = '';
         $post_proc_engine = Factory::getConfiguration()->get('akeeba.advanced.postproc_engine');
         if (!empty($post_proc_engine) && $post_proc_engine != 'none') {
             if (empty($stat->remote_filename)) {
                 $remote_status = Platform::getInstance()->translate('COM_AKEEBA_EMAIL_POSTPROCESSING_FAILED');
             } else {
                 $remote_status = Platform::getInstance()->translate('COM_AKEEBA_EMAIL_POSTPROCESSING_SUCCESS');
             }
         }
         // Do we need a default subject?
         if (empty($subject)) {
             // Get the default subject
             $subject = Platform::getInstance()->translate('EMAIL_SUBJECT_OK');
         } else {
             // Post-process the subject
             $subject = Factory::getFilesystemTools()->replace_archive_name_variables($subject);
         }
         // Do we need a default body?
         if (empty($body)) {
             $body = Platform::getInstance()->translate('EMAIL_BODY_OK');
             $info_source = Platform::getInstance()->translate('EMAIL_BODY_INFO');
             $body .= "\n\n" . sprintf($info_source, $profile_number, $num_parts) . "\n\n";
             $body .= $parts_list;
         } else {
             // Post-process the body
             $body = Factory::getFilesystemTools()->replace_archive_name_variables($body);
             $body = str_replace('[PROFILENUMBER]', $profile_number, $body);
             $body = str_replace('[PROFILENAME]', $profile_name, $body);
             $body = str_replace('[PARTCOUNT]', $num_parts, $body);
             $body = str_replace('[FILELIST]', $parts_list, $body);
             $body = str_replace('[REMOTESTATUS]', $remote_status, $body);
         }
         // Sometimes $body contains literal \n instead of newlines
         $body = str_replace('\\n', "\n", $body);
         foreach ($emails as $email) {
             Factory::getLog()->log(LogLevel::DEBUG, "Sending email to {$email}");
             Platform::getInstance()->send_email($email, $subject, $body);
         }
     } else {
         Factory::getLog()->log(LogLevel::DEBUG, "No email recipients found! Skipping email.");
     }
     return true;
 }
开发者ID:ForAEdesWeb,项目名称:AEW2,代码行数:95,代码来源:Finalization.php

示例10: updateMagicParameters

 /**
  * Update the cached live site's URL for the front-end backup feature (altbackup.php)
  * and the detected Joomla! libraries path
  */
 public function updateMagicParameters()
 {
     $component = JComponentHelper::getComponent('com_akeeba');
     if (is_object($component->params) && $component->params instanceof JRegistry) {
         $params = $component->params;
     } else {
         $params = new JRegistry($component->params);
     }
     if (!$params->get('confwiz_upgrade', 0)) {
         $this->markOldProfilesConfigured();
     }
     $params->set('confwiz_upgrade', 1);
     $params->set('siteurl', str_replace('/administrator', '', JUri::base()));
     if (defined('JPATH_LIBRARIES')) {
         $params->set('jlibrariesdir', Factory::getFilesystemTools()->TranslateWinPath(JPATH_LIBRARIES));
     } elseif (defined("JPATH_PLATFORM")) {
         $params->set('jlibrariesdir', Factory::getFilesystemTools()->TranslateWinPath(JPATH_PLATFORM));
     }
     $params->set('jversion', '1.6');
     $db = F0FPlatform::getInstance()->getDbo();
     $data = $params->toString();
     $sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('element') . ' = ' . $db->q('com_akeeba'))->where($db->qn('type') . ' = ' . $db->q('component'));
     $db->setQuery($sql);
     $db->execute();
 }
开发者ID:hixbotay,项目名称:executivetransport,代码行数:29,代码来源:cpanels.php

示例11: updateMagicParameters

 /**
  * Updates some internal settings:
  *
  * - The stored URL of the site, used for the front-end backup feature (altbackup.php)
  * - The detected Joomla! libraries path
  * - Marks all existing profiles as configured, if necessary
  */
 public function updateMagicParameters()
 {
     if (!$this->container->params->get('confwiz_upgrade', 0)) {
         $this->markOldProfilesConfigured();
     }
     $this->container->params->set('confwiz_upgrade', 1);
     $this->container->params->set('siteurl', str_replace('/administrator', '', JUri::base()));
     $this->container->params->set('jlibrariesdir', Factory::getFilesystemTools()->TranslateWinPath(JPATH_LIBRARIES));
     $this->container->params->set('jversion', '1.6');
     $this->container->params->save();
 }
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:18,代码来源:ControlPanel.php

示例12: initialiseConnector

 /**
  * Initialises the OneDrive connector object
  *
  * @return  bool  True on success, false if we cannot proceed
  */
 protected function initialiseConnector()
 {
     // Retrieve engine configuration data
     $config = Factory::getConfiguration();
     $access_token = trim($config->get('engine.postproc.dropbox2.access_token', ''));
     $this->chunked = $config->get('engine.postproc.dropbox2.chunk_upload', true);
     $this->chunk_size = $config->get('engine.postproc.dropbox2.chunk_upload_size', 10) * 1024 * 1024;
     $this->directory = $config->get('volatile.postproc.directory', null);
     if (empty($this->directory)) {
         $this->directory = $config->get('engine.postproc.dropbox2.directory', '');
     }
     // Sanity checks
     if (empty($access_token)) {
         $this->setError('You have not linked Akeeba Backup with your Dropbox account');
         return false;
     }
     if (!function_exists('curl_init')) {
         $this->setWarning('cURL is not enabled, please enable it in order to post-process your archives');
         return false;
     }
     // Fix the directory name, if required
     if (!empty($this->directory)) {
         $this->directory = trim($this->directory);
         $this->directory = ltrim(Factory::getFilesystemTools()->TranslateWinPath($this->directory), '/');
     } else {
         $this->directory = '';
     }
     // Parse tags
     $this->directory = Factory::getFilesystemTools()->replace_archive_name_variables($this->directory);
     $config->set('volatile.postproc.directory', $this->directory);
     $this->dropbox2 = new ConnectorDropboxV2($access_token);
     return true;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:38,代码来源:Dropbox2.php

示例13: array

 public function &getFolders($folder, &$position)
 {
     // Was the breakflag set BEFORE starting? -- This workaround is required due to PHP5 defaulting to assigning variables by reference
     $registry = Factory::getConfiguration();
     $breakflag_before_process = $registry->get('volatile.breakflag', false);
     // Reset break flag before continuing
     $breakflag = false;
     // Initialize variables
     $arr = array();
     $false = false;
     if (!is_dir($folder) && !is_dir($folder . '/')) {
         return $false;
     }
     $counter = 0;
     $registry = Factory::getConfiguration();
     $maxCounter = $registry->get('engine.scan.smart.large_dir_threshold', 100);
     $allowBreakflag = $registry->get('volatile.operation_counter', 0) != 0 && !$breakflag_before_process;
     if (!@is_readable($folder)) {
         $this->setWarning('Unreadable directory ' . $folder);
         return $false;
     }
     $di = new \DirectoryIterator($folder);
     $ds = $folder == '' || $folder == '/' || @substr($folder, -1) == '/' || @substr($folder, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
     /** @var \DirectoryIterator $file */
     foreach ($di as $file) {
         if ($breakflag) {
             break;
         }
         if ($file->isDot()) {
             continue;
         }
         if (!$file->isDir()) {
             continue;
         }
         $dir = $folder . $ds . $file->getFilename();
         $data = $dir;
         if (_AKEEBA_IS_WINDOWS) {
             $data = Factory::getFilesystemTools()->TranslateWinPath($dir);
         }
         if ($data) {
             $arr[] = $data;
         }
         $counter++;
         if ($counter >= $maxCounter) {
             $breakflag = $allowBreakflag;
         }
     }
     // Save break flag status
     $registry->set('volatile.breakflag', $breakflag);
     return $arr;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:51,代码来源:Smart.php

示例14: notifyFailed

    /**
     * Send an email notification for failed backups
     *
     * @return  array  See the CLI script
     */
    public function notifyFailed()
    {
        // Invalidate stale backups
        Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $this->container->params->get('failure_timeout', 180)));
        // Get the last execution and search for failed backups AFTER that date
        $last = $this->getLastCheck();
        // Get failed backups
        $filters[] = array('field' => 'status', 'operand' => '=', 'value' => 'fail');
        $filters[] = array('field' => 'origin', 'operand' => '<>', 'value' => 'restorepoint');
        $filters[] = array('field' => 'backupstart', 'operand' => '>', 'value' => $last);
        $failed = Platform::getInstance()->get_statistics_list(array('filters' => $filters));
        // Well, everything went ok.
        if (!$failed) {
            return array('message' => array("No need to run: no failed backups or notifications were already sent."), 'result' => true);
        }
        // Whops! Something went wrong, let's start notifing
        $superAdmins = array();
        $superAdminEmail = $this->container->params->get('failure_email_address', '');
        if (!empty($superAdminEmail)) {
            $superAdmins = $this->getSuperUsers($superAdminEmail);
        }
        if (empty($superAdmins)) {
            $superAdmins = $this->getSuperUsers();
        }
        if (empty($superAdmins)) {
            return array('message' => array("WARNING! Failed backup(s) detected, but there are no configured Super Administrators to receive notifications"), 'result' => false);
        }
        $failedReport = array();
        foreach ($failed as $fail) {
            $string = "Description : " . $fail['description'] . "\n";
            $string .= "Start time  : " . $fail['backupstart'] . "\n";
            $string .= "Origin      : " . $fail['origin'] . "\n";
            $string .= "Type        : " . $fail['type'] . "\n";
            $string .= "Profile ID  : " . $fail['profile_id'];
            $failedReport[] = $string;
        }
        $failedReport = implode("\n#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+#\n", $failedReport);
        $email_subject = $this->container->params->get('failure_email_subject', '');
        if (!$email_subject) {
            $email_subject = <<<ENDSUBJECT
THIS EMAIL IS SENT FROM YOUR SITE "[SITENAME]" - Failed backup(s) detected
ENDSUBJECT;
        }
        $email_body = $this->container->params->get('failure_email_body', '');
        if (!$email_body) {
            $email_body = <<<ENDBODY
================================================================================
FAILED BACKUP ALERT
================================================================================

Your site has determined that there are failed backups.

The following backups are found to be failing:

[FAILEDLIST]

================================================================================
WHY AM I RECEIVING THIS EMAIL?
================================================================================

This email has been automatically sent by scritp you, or the person who built
or manages your site, has installed and explicitly configured. This script looks
for failed backups and sends an email notification to all Super Users.

If you do not understand what this means, please do not contact the authors of
the software. They are NOT sending you this email and they cannot help you.
Instead, please contact the person who built or manages your site.

================================================================================
WHO SENT ME THIS EMAIL?
================================================================================

This email is sent to you by your own site, [SITENAME]

ENDBODY;
        }
        $jconfig = JFactory::getConfig();
        $mailfrom = $jconfig->get('mailfrom');
        $fromname = $jconfig->get('fromname');
        $email_subject = Factory::getFilesystemTools()->replace_archive_name_variables($email_subject);
        $email_body = Factory::getFilesystemTools()->replace_archive_name_variables($email_body);
        $email_body = str_replace('[FAILEDLIST]', $failedReport, $email_body);
        foreach ($superAdmins as $sa) {
            try {
                $mailer = JFactory::getMailer();
                $mailer->setSender(array($mailfrom, $fromname));
                $mailer->addRecipient($sa->email);
                $mailer->setSubject($email_subject);
                $mailer->setBody($email_body);
                $mailer->Send();
            } catch (\Exception $e) {
                // Joomla! 3.5 is written by incompetent bonobos
            }
        }
        // Let's update the last time we check, so we will avoid to send
//.........这里部分代码省略.........
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:101,代码来源:Statistics.php

示例15: array

 public function &getFolders($folder, $fullpath = false)
 {
     // Initialize variables
     $arr = array();
     $false = false;
     if (!is_dir($folder) && !is_dir($folder . '/')) {
         return $false;
     }
     $handle = @opendir($folder);
     if ($handle === false) {
         $handle = @opendir($folder . '/');
     }
     // If directory is not accessible, just return FALSE
     if ($handle === false) {
         return $false;
     }
     $registry = Factory::getConfiguration();
     $dereferencesymlinks = $registry->get('engine.archiver.common.dereference_symlinks');
     while (($file = @readdir($handle)) !== false) {
         if ($file != '.' && $file != '..') {
             $dir = "{$folder}/{$file}";
             $isDir = @is_dir($dir);
             $isLink = @is_link($dir);
             if ($isDir) {
                 //if(!$dereferencesymlinks && $isLink) continue;
                 if ($fullpath) {
                     $data = _AKEEBA_IS_WINDOWS ? Factory::getFilesystemTools()->TranslateWinPath($dir) : $dir;
                 } else {
                     $data = _AKEEBA_IS_WINDOWS ? Factory::getFilesystemTools()->TranslateWinPath($file) : $file;
                 }
                 if ($data) {
                     $arr[] = $data;
                 }
             }
         }
     }
     @closedir($handle);
     return $arr;
 }
开发者ID:jvhost,项目名称:A-Website,代码行数:39,代码来源:FileLister.php


注:本文中的Akeeba\Engine\Factory::getFilesystemTools方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。