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


PHP Maged_Controller::model方法代码示例

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


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

示例1: _installFile2


//.........这里部分代码省略.........
                 $task =& new $task($this->config, $this, PEAR_TASK_INSTALL);
                 if (!$task->isScript()) {
                     // scripts are only handled after installation
                     $task->init($raw, $attribs, $pkg->getLastInstalledVersion());
                     $res = $task->startSession($pkg, $contents, $final_dest_file);
                     if ($res === false) {
                         continue;
                         // skip this file
                     }
                     if (PEAR::isError($res)) {
                         return $res;
                     }
                     $contents = $res;
                     // save changes
                 }
                 $wp = @fopen($dest_file, "wb");
                 if (!is_resource($wp)) {
                     return $this->raiseError("failed to create {$dest_file}: {$php_errormsg}", PEAR_INSTALLER_FAILED);
                 }
                 if (fwrite($wp, $contents) === false) {
                     return $this->raiseError("failed writing to {$dest_file}: {$php_errormsg}", PEAR_INSTALLER_FAILED);
                 }
                 fclose($wp);
             }
         }
         // {{{ check the md5
         if (isset($md5sum)) {
             if (strtolower($md5sum) === strtolower($attribs['md5sum'])) {
                 $this->log(2, "md5sum ok: {$final_dest_file}");
             } else {
                 if (empty($options['force'])) {
                     // delete the file
                     if (file_exists($dest_file)) {
                         unlink($dest_file);
                     }
                     if (!isset($options['ignore-errors'])) {
                         return $this->raiseError("bad md5sum for file {$final_dest_file}", PEAR_INSTALLER_FAILED);
                     } else {
                         if (!isset($options['soft'])) {
                             $this->log(0, "warning : bad md5sum for file {$final_dest_file}");
                         }
                     }
                 } else {
                     if (!isset($options['soft'])) {
                         $this->log(0, "warning : bad md5sum for file {$final_dest_file}");
                     }
                 }
             }
         }
         // }}}
         // {{{ set file permissions
         if (!OS_WINDOWS) {
             if ($role->isExecutable()) {
                 $mode = 0777 & ~(int) octdec($this->config->get('umask'));
                 $this->log(3, "+ chmod +x {$dest_file}");
             } else {
                 $mode = 0666 & ~(int) octdec($this->config->get('umask'));
             }
             /*
              * Magento fix for custom set permissions in config.ini
              */
             if (class_exists('Maged_Controller', false)) {
                 $magedConfig = Maged_Controller::model('Config', true)->load();
                 if ($magedConfig->get('use_custom_permissions_mode') == '1') {
                     if ($role->isExecutable() && ($configMode = $magedConfig->get('chmod_file_mode_executable'))) {
                         $mode = $magedConfig;
                     }
                     if (!$role->isExecutable() && ($configMode = $magedConfig->get('chmod_file_mode'))) {
                         $mode = $magedConfig;
                     }
                 }
             }
             /*
              * End fix
              */
             if ($attribs['role'] != 'src') {
                 $this->addFileOperation("chmod", array($mode, $dest_file));
                 if (!@chmod($dest_file, $mode)) {
                     if (!isset($options['soft'])) {
                         $this->log(0, "failed to change mode of {$dest_file}: {$php_errormsg}");
                     }
                 }
             }
         }
         // }}}
         if ($attribs['role'] == 'src') {
             rename($dest_file, $final_dest_file);
             $this->log(2, "renamed source file {$dest_file} to {$final_dest_file}");
         } else {
             $this->addFileOperation("rename", array($dest_file, $final_dest_file, $role->isExtension()));
         }
     }
     // Store the full path where the file was installed for easy uninstall
     if ($attribs['role'] != 'src') {
         $loc = $this->config->get($role->getLocationConfig(), null, $channel);
         $this->addFileOperation("installed_as", array($file, $installed_as, $loc, dirname(substr($installed_as, strlen($loc)))));
     }
     //$this->log(2, "installed: $dest_file");
     return PEAR_INSTALLER_OK;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:101,代码来源:Installer.php

示例2: mkDirHier

 /**
  * Wrapper to System::mkDir(), creates a directory as well as
  * any necessary parent directories.
  *
  * @param string  $dir  directory name
  *
  * @return bool TRUE on success, or a PEAR error
  *
  * @access public
  */
 function mkDirHier($dir)
 {
     $this->log(2, "+ create dir {$dir}");
     if (!class_exists('System')) {
         require_once 'System.php';
     }
     /*
      * Magento fix for custom set permissions in config.ini
      */
     if (class_exists('Maged_Controller', false)) {
         $magedConfig = Maged_Controller::model('Config', true)->load();
         if ($magedConfig->get('use_custom_permissions_mode') == '1' && ($mode = $magedConfig->get('mkdir_mode'))) {
             return System::mkDir(array('-m' . $mode, $dir));
         }
     }
     /*
      * End fix
      */
     return System::mkDir(array('-p', $dir));
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:30,代码来源:Common.php

示例3: tmpdir

 /**
  * Get the path of the temporal directory set in the system
  * by looking in its environments variables.
  * Note: php.ini-recommended removes the "E" from the variables_order setting,
  * making unavaible the $_ENV array, that s why we do tests with _ENV
  *
  * @static 
  * @return string The temporary directory on the system
  */
 function tmpdir()
 {
     /*
      * Magento fix for set tmp dir in config.ini
      */
     if (class_exists('Maged_Controller', false)) {
         $magedConfig = Maged_Controller::model('Config', true)->load();
         if (!is_null($tmpDir = $magedConfig->get('tmp_dir'))) {
             return $tmpDir;
         }
     }
     /*
      * End fix
      */
     if (OS_WINDOWS) {
         if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
             return $var;
         }
         if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
             return $var;
         }
         if ($var = isset($_ENV['USERPROFILE']) ? $_ENV['USERPROFILE'] : getenv('USERPROFILE')) {
             return $var;
         }
         if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
             return $var;
         }
         return getenv('SystemRoot') . '\\temp';
     }
     if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
         return $var;
     }
     return realpath('/tmp');
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:43,代码来源:System.php


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