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


PHP System::mkdir方法代码示例

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


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

示例1: processInstallation

 function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
 {
     $test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer);
     if (@file_exists($test[2])) {
         // configuration has already been installed, check for mods
         if (md5_file($test[2]) !== md5_file($test[3])) {
             // configuration has been modified, so save our version as
             // configfile-version
             $old = $test[2];
             $test[2] .= '.new-' . $pkg->getVersion();
             // backup original and re-install it
             PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
             $tmpcfg = $this->config->get('temp_dir');
             $newloc = System::mkdir(array('-p', $tmpcfg));
             if (!$newloc) {
                 // try temp_dir
                 $newloc = System::mktemp(array('-d'));
                 if (!$newloc || PEAR::isError($newloc)) {
                     PEAR::popErrorHandling();
                     return PEAR::raiseError('Could not save existing configuration file ' . $old . ', unable to install.  Please set temp_dir ' . 'configuration variable to a writeable location and try again');
                 }
             } else {
                 $newloc = $tmpcfg;
             }
             if (!@copy($old, $newloc . DIRECTORY_SEPARATOR . 'savefile')) {
                 PEAR::popErrorHandling();
                 return PEAR::raiseError('Could not save existing configuration file ' . $old . ', unable to install.  Please set temp_dir ' . 'configuration variable to a writeable location and try again');
             }
             PEAR::popErrorHandling();
             $this->installer->addFileOperation('rename', array($newloc . DIRECTORY_SEPARATOR . 'savefile', $old, false));
             $this->installer->addFileOperation('delete', array($newloc . DIRECTORY_SEPARATOR . 'savefile'));
         }
     }
     return $test;
 }
开发者ID:arkosoft,项目名称:S-Admin,代码行数:35,代码来源:Cfg.php

示例2: cache

 private function cache()
 {
     // is it a remote image?
     if ($this->is_remote()) {
         $path = $this->image_folder . '/imagecache/original';
         $image_original_name = "{$path}/" . preg_replace('/\\W/i', '-', $this->image_src);
         if (!file_exists($image_original_name)) {
             //make sure the directory(s) exist
             System::mkdir($path);
             // download image
             copy($this->image_src, $image_original_name);
         }
         unset($path);
     } else {
         // $image_original_name = Route::get('media')->uri(array('file' => $this->image_src));
         $image_original_name = Kohana::find_file('media', $this->image_src, FALSE);
     }
     //if image file not found stop here
     if (!$this->is_valid($image_original_name)) {
         return FALSE;
     }
     $this->resized_image = "{$this->image_folder}/imagecache/{$this->resize_type}/{$this->width}x{$this->height}/{$this->image_src}";
     if (!file_exists($this->resized_image)) {
         //make sure the directory(s) exist
         $path = pathinfo($this->resized_image, PATHINFO_DIRNAME);
         System::mkdir($path);
         // Save the resized image to the public directory for future requests
         $image_function = $this->resize_type === 'crop' ? 'crop' : 'resize';
         Image::factory($image_original_name)->{$image_function}($this->width, $this->height)->save($this->resized_image, 85);
     }
     return TRUE;
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:32,代码来源:resize.php

示例3: addLang

 /**
  * Creates a new entry in the langs_avail .ini file.
  *
  * @param array  $langData language data
  * @param string $path     path to gettext data dir
  *
  * @return  mixed   Returns true on success or PEAR_Error on failure.
  */
 function addLang($langData, $path = null)
 {
     if (!isset($path) || !is_string($path)) {
         $path = $this->_domains[$this->options['default_domain']];
     }
     $path .= '/' . $langData['lang_id'] . '/LC_MESSAGES';
     if (!is_dir($path)) {
         include_once 'System.php';
         if (!System::mkdir(array('-p', $path))) {
             return $this->raiseError(sprintf('Cannot create new language in path "%s"', $path), TRANSLATION2_ERROR_CANNOT_CREATE_DIR);
         }
     }
     return true;
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:22,代码来源:gettext.php

示例4: saveCache

 function saveCache($args, $data)
 {
     $id = md5(serialize($args));
     $cachedir = $this->config->get('cache_dir');
     if (!file_exists($cachedir)) {
         System::mkdir(array('-p', $cachedir));
     }
     $filename = $cachedir . '/xmlrpc_cache_' . $id;
     $fp = @fopen($filename, "wb");
     if ($fp) {
         fwrite($fp, serialize($data));
         fclose($fp);
     }
 }
开发者ID:BackupTheBerlios,项目名称:wcms,代码行数:14,代码来源:Remote.php

示例5: action_serve

 /**
  * Static file serving (CSS, JS, images, etc.)
  *
  * @uses  Request::param
  * @uses  Request::uri
  * @uses  Kohana::find_file
  * @uses  Response::check_cache
  * @uses  Response::body
  * @uses  Response::headers
  * @uses  Response::status
  * @uses  File::mime_by_ext
  * @uses  File::getExt
  * @uses  Config::get
  * @uses  Log::add
  * @uses  System::mkdir
  */
 public function action_serve()
 {
     // Get file theme from the request
     $theme = $this->request->param('theme', FALSE);
     // Get the file path from the request
     $file = $this->request->param('file');
     // Find the file extension
     $ext = File::getExt($file);
     // Remove the extension from the filename
     $file = substr($file, 0, -(strlen($ext) + 1));
     if ($file_name = Kohana::find_file('media', $file, $ext)) {
         // Check if the browser sent an "if-none-match: <etag>" header, and tell if the file hasn't changed
         $this->response->check_cache(sha1($this->request->uri()) . filemtime($file_name), $this->request);
         // Send the file content as the response
         $this->response->body(file_get_contents($file_name));
         // Set the proper headers to allow caching
         $this->response->headers('content-type', File::mime_by_ext($ext));
         $this->response->headers('last-modified', date('r', filemtime($file_name)));
         // This is ignored by check_cache
         $this->response->headers('cache-control', 'public, max-age=2592000');
         if (Config::get('media.cache', FALSE)) {
             // Set base path
             $path = Config::get('media.public_dir', 'media');
             // Override path if we're in admin
             if ($theme) {
                 $path = $path . DS . $theme;
             }
             // Save the contents to the public directory for future requests
             $public_path = $path . DS . $file . '.' . $ext;
             $directory = dirname($public_path);
             if (!is_dir($directory)) {
                 // Recursively create the directories needed for the file
                 System::mkdir($directory, 0777, TRUE);
             }
             file_put_contents($public_path, $this->response->body());
         }
     } else {
         Log::error('Media controller error while loading file: :file', array(':file' => $file));
         // Return a 404 status
         $this->response->status(404);
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:58,代码来源:media.php

示例6: doUpdate

 function doUpdate($command, $options, $params)
 {
     $tmpdir = $this->config->get('temp_dir');
     if (!file_exists($tmpdir)) {
         require_once 'System.php';
         PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
         $err = System::mkdir(array('-p', $tmpdir));
         PEAR::staticPopErrorHandling();
         if (PEAR::isError($err)) {
             return $this->raiseError('channel-add: temp_dir does not exist: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"');
         }
     }
     if (!is_writable($tmpdir)) {
         return $this->raiseError('channel-add: temp_dir is not writable: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"');
     }
     $reg =& $this->config->getRegistry();
     if (sizeof($params) != 1) {
         return $this->raiseError("No channel file specified");
     }
     $lastmodified = false;
     if ((!file_exists($params[0]) || is_dir($params[0])) && $reg->channelExists(strtolower($params[0]))) {
         $c = $reg->getChannel(strtolower($params[0]));
         if (PEAR::isError($c)) {
             return $this->raiseError($c);
         }
         $this->ui->outputData("Updating channel \"{$params['0']}\"", $command);
         $dl =& $this->getDownloader(array());
         // if force is specified, use a timestamp of "1" to force retrieval
         $lastmodified = isset($options['force']) ? false : $c->lastModified();
         PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
         $contents = $dl->downloadHttp('http://' . $c->getName() . '/channel.xml', $this->ui, $tmpdir, null, $lastmodified);
         PEAR::staticPopErrorHandling();
         if (PEAR::isError($contents)) {
             return $this->raiseError('Cannot retrieve channel.xml for channel "' . $c->getName() . '" (' . $contents->getMessage() . ')');
         }
         list($contents, $lastmodified) = $contents;
         if (!$contents) {
             $this->ui->outputData("Channel \"{$params['0']}\" is up to date");
             return;
         }
         $contents = implode('', file($contents));
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $channel = new PEAR_ChannelFile();
         $channel->fromXmlString($contents);
         if (!$channel->getErrors()) {
             // security check: is the downloaded file for the channel we got it from?
             if (strtolower($channel->getName()) != strtolower($c->getName())) {
                 if (isset($options['force'])) {
                     $this->ui->log(0, 'WARNING: downloaded channel definition file' . ' for channel "' . $channel->getName() . '" from channel "' . strtolower($c->getName()) . '"');
                 } else {
                     return $this->raiseError('ERROR: downloaded channel definition file' . ' for channel "' . $channel->getName() . '" from channel "' . strtolower($c->getName()) . '"');
                 }
             }
         }
     } else {
         if (strpos($params[0], '://')) {
             $dl =& $this->getDownloader();
             PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
             $loc = $dl->downloadHttp($params[0], $this->ui, $tmpdir, null, $lastmodified);
             PEAR::staticPopErrorHandling();
             if (PEAR::isError($loc)) {
                 return $this->raiseError("Cannot open " . $params[0] . ' (' . $loc->getMessage() . ')');
             } else {
                 list($loc, $lastmodified) = $loc;
                 $contents = implode('', file($loc));
             }
         } else {
             $fp = false;
             if (file_exists($params[0])) {
                 $fp = fopen($params[0], 'r');
             }
             if (!$fp) {
                 return $this->raiseError("Cannot open " . $params[0]);
             }
             $contents = '';
             while (!feof($fp)) {
                 $contents .= fread($fp, 1024);
             }
             fclose($fp);
         }
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $channel = new PEAR_ChannelFile();
         $channel->fromXmlString($contents);
     }
     $exit = false;
     if (count($errors = $channel->getErrors(true))) {
         foreach ($errors as $error) {
             $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message']));
             if (!$exit) {
                 $exit = $error['level'] == 'error' ? true : false;
             }
         }
         if ($exit) {
             return $this->raiseError('Invalid channel.xml file');
         }
     }
//.........这里部分代码省略.........
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:Channels.php

示例7: compile

 /**
  *   compile the template
  *
  *   @access     public
  *   @version    01/12/03
  *   @author     Wolfram Kriesing <wolfram@kriesing.de>
  *   @param      string  $file   relative to the 'templateDir' which you set when calling the constructor
  *   @return     boolean true on success. (or string, if compileToString) PEAR_Error on failure..
  */
 function compile($file)
 {
     if (!$file) {
         return $this->raiseError('HTML_Template_Flexy::compile no file selected', HTML_TEMPLATE_FLEXY_ERROR_INVALIDARGS, HTML_TEMPLATE_FLEXY_ERROR_DIE);
     }
     if (!@$this->options['locale']) {
         $this->options['locale'] = 'en';
     }
     //Remove the slash if there is one in front, just to be safe.
     $file = ltrim($file, DIRECTORY_SEPARATOR);
     if (strpos($file, '#')) {
         list($file, $this->options['output.block']) = explode('#', $file);
     }
     $parts = array();
     $tmplDirUsed = false;
     // PART A mulitlanguage support: ( part B is gettext support in the engine..)
     //    - user created language version of template.
     //    - compile('abcdef.html') will check for compile('abcdef.en.html')
     //       (eg. when locale=en)
     $this->currentTemplate = false;
     if (preg_match('/(.*)(\\.[a-z]+)$/i', $file, $parts)) {
         $newfile = $parts[1] . '.' . $this->options['locale'] . $parts[2];
         foreach ($this->options['templateDir'] as $tmplDir) {
             if (@(!file_exists($tmplDir . DIRECTORY_SEPARATOR . $newfile))) {
                 continue;
             }
             $file = $newfile;
             $this->currentTemplate = $tmplDir . DIRECTORY_SEPARATOR . $newfile;
             $tmplDirUsed = $tmplDir;
         }
     }
     // look in all the posible locations for the template directory..
     if ($this->currentTemplate === false) {
         $dirs = array_unique($this->options['templateDir']);
         if ($this->options['templateDirOrder'] == 'reverse') {
             $dirs = array_reverse($dirs);
         }
         foreach ($dirs as $tmplDir) {
             if (!@file_exists($tmplDir . DIRECTORY_SEPARATOR . $file)) {
                 continue;
             }
             if (!$this->options['multiSource'] && $this->currentTemplate !== false) {
                 return $this->raiseError("You have more than one template Named {$file} in your paths, found in both" . "<BR>{$this->currentTemplate}<BR>{$tmplDir}" . DIRECTORY_SEPARATOR . $file, HTML_TEMPLATE_FLEXY_ERROR_INVALIDARGS, HTML_TEMPLATE_FLEXY_ERROR_DIE);
             }
             $this->currentTemplate = $tmplDir . DIRECTORY_SEPARATOR . $file;
             $tmplDirUsed = $tmplDir;
         }
     }
     if ($this->currentTemplate === false) {
         // check if the compile dir has been created
         return $this->raiseError("Could not find Template {$file} in any of the directories<br>" . implode("<BR>", $this->options['templateDir']), HTML_TEMPLATE_FLEXY_ERROR_INVALIDARGS, HTML_TEMPLATE_FLEXY_ERROR_DIE);
     }
     // Savant compatible compiler
     if (is_string($this->options['compiler']) && $this->options['compiler'] == 'Raw') {
         $this->compiledTemplate = $this->currentTemplate;
         $this->debug("Using Raw Compiler");
         return true;
     }
     // now for the compile target
     //If you are working with mulitple source folders and $options['multiSource'] is set
     //the template folder will be:
     // compiled_tempaltes/{templatedir_basename}_{md5_of_dir}/
     $compileSuffix = count($this->options['templateDir']) > 1 && $this->options['multiSource'] ? DIRECTORY_SEPARATOR . basename($tmplDirUsed) . '_' . md5($tmplDirUsed) : '';
     $compileDest = isset($this->options['compileDir']) ? $this->options['compileDir'] : '';
     $isTmp = false;
     // Use a default compile directory if one has not been set.
     if (!$compileDest) {
         // Use session.save_path + 'compiled_templates_' + md5(of sourcedir)
         $compileDest = ini_get('session.save_path') . DIRECTORY_SEPARATOR . 'flexy_compiled_templates';
         if (!file_exists($compileDest)) {
             require_once 'System.php';
             System::mkdir(array('-p', $compileDest));
         }
         $isTmp = true;
     }
     // we generally just keep the directory structure as the application uses it,
     // so we dont get into conflict with names
     // if we have multi sources we do md5 the basedir..
     $base = $compileDest . $compileSuffix . DIRECTORY_SEPARATOR . $file;
     $fullFile = $this->compiledTemplate = $base . '.' . $this->options['locale'] . '.php';
     $this->getTextStringsFile = $base . '.gettext.serial';
     $this->elementsFile = $base . '.elements.serial';
     if (isset($this->options['output.block'])) {
         $this->compiledTemplate .= '#' . $this->options['output.block'];
     }
     if (!empty($this->options['dontCompile'])) {
         return true;
     }
     $recompile = false;
     $isuptodate = file_exists($this->compiledTemplate) ? filemtime($this->currentTemplate) == filemtime($this->compiledTemplate) : 0;
     if (!empty($this->options['forceCompile']) || !$isuptodate) {
//.........这里部分代码省略.........
开发者ID:altesien,项目名称:FinalProject,代码行数:101,代码来源:Flexy.php

示例8: doBundle

 function doBundle($command, $options, $params)
 {
     if (empty($this->installer)) {
         $this->installer =& new PEAR_Installer($this->ui);
     }
     $installer =& $this->installer;
     if (sizeof($params) < 1) {
         return $this->raiseError("Please supply the package you want to bundle");
     }
     $pkgfile = $params[0];
     $need_download = false;
     if (preg_match('#^(http|ftp)://#', $pkgfile)) {
         $need_download = true;
     } elseif (!@is_file($pkgfile)) {
         if ($installer->validPackageName($pkgfile)) {
             $pkgfile = $installer->getPackageDownloadUrl($pkgfile);
             $need_download = true;
         } else {
             if (strlen($pkgfile)) {
                 return $this->raiseError("Could not open the package file: {$pkgfile}");
             } else {
                 return $this->raiseError("No package file given");
             }
         }
     }
     // Download package -----------------------------------------------
     if ($need_download) {
         $downloaddir = $installer->config->get('download_dir');
         if (empty($downloaddir)) {
             if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
                 return $downloaddir;
             }
             $installer->log(2, '+ tmp dir created at ' . $downloaddir);
         }
         $callback = $this->ui ? array(&$installer, '_downloadCallback') : null;
         $file = $installer->downloadHttp($pkgfile, $this->ui, $downloaddir, $callback);
         if (PEAR::isError($file)) {
             return $this->raiseError($file);
         }
         $pkgfile = $file;
     }
     // Parse xml file -----------------------------------------------
     $pkginfo = $installer->infoFromTgzFile($pkgfile);
     if (PEAR::isError($pkginfo)) {
         return $this->raiseError($pkginfo);
     }
     $installer->validatePackageInfo($pkginfo, $errors, $warnings);
     // XXX We allow warnings, do we have to do it?
     if (count($errors)) {
         if (empty($options['force'])) {
             return $this->raiseError("The following errors where found:\n" . implode("\n", $errors));
         } else {
             $this->log(0, "warning : the following errors were found:\n" . implode("\n", $errors));
         }
     }
     $pkgname = $pkginfo['package'];
     // Unpacking -------------------------------------------------
     if (isset($options['destination'])) {
         if (!is_dir($options['destination'])) {
             System::mkdir('-p ' . $options['destination']);
         }
         $dest = realpath($options['destination']);
     } else {
         $pwd = getcwd();
         if (is_dir($pwd . DIRECTORY_SEPARATOR . 'ext')) {
             $dest = $pwd . DIRECTORY_SEPARATOR . 'ext';
         } else {
             $dest = $pwd;
         }
     }
     $dest .= DIRECTORY_SEPARATOR . $pkgname;
     $orig = $pkgname . '-' . $pkginfo['version'];
     $tar = new Archive_Tar($pkgfile);
     if (!@$tar->extractModify($dest, $orig)) {
         return $this->raiseError("unable to unpack {$pkgfile}");
     }
     $this->ui->outputData("Package ready at '{$dest}'");
     // }}}
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:79,代码来源:Install.php

示例9: saveCache

 /**
  * @param string full URL to REST resource
  * @param string original contents of the REST resource
  * @param array  HTTP Last-Modified and ETag headers
  * @param bool   if true, then the cache id file should be regenerated to
  *               trigger a new time-to-live value
  */
 function saveCache($url, $contents, $lastmodified, $nochange = false, $cacheid = null)
 {
     $cache_dir = $this->config->get('cache_dir');
     $d = $cache_dir . DIRECTORY_SEPARATOR . md5($url);
     $cacheidfile = $d . 'rest.cacheid';
     $cachefile = $d . 'rest.cachefile';
     if (!is_dir($cache_dir)) {
         if (System::mkdir(array('-p', $cache_dir)) === false) {
             return PEAR::raiseError("The value of config option cache_dir ({$cache_dir}) is not a directory and attempts to create the directory failed.");
         }
     }
     if (!is_writeable($cache_dir)) {
         // If writing to the cache dir is not going to work, silently do nothing.
         // An ugly hack, but retains compat with PEAR 1.9.1 where many commands
         // work fine as non-root user (w/out write access to default cache dir).
         return true;
     }
     if ($cacheid === null && $nochange) {
         $cacheid = unserialize(implode('', file($cacheidfile)));
     }
     $idData = serialize(array('age' => time(), 'lastChange' => $nochange ? $cacheid['lastChange'] : $lastmodified));
     $result = $this->saveCacheFile($cacheidfile, $idData);
     if (PEAR::isError($result)) {
         return $result;
     } elseif ($nochange) {
         return true;
     }
     $result = $this->saveCacheFile($cachefile, serialize($contents));
     if (PEAR::isError($result)) {
         if (file_exists($cacheidfile)) {
             @unlink($cacheidfile);
         }
         return $result;
     }
     return true;
 }
开发者ID:michabbb,项目名称:pear-core,代码行数:43,代码来源:REST.php

示例10: saveCache

 /**
  * @param string full URL to REST resource
  * @param string original contents of the REST resource
  * @param array  HTTP Last-Modified and ETag headers
  * @param bool   if true, then the cache id file should be regenerated to
  *               trigger a new time-to-live value
  */
 function saveCache($url, $contents, $lastmodified, $nochange = false, $cacheid = null)
 {
     $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . md5($url) . 'rest.cacheid';
     $cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . md5($url) . 'rest.cachefile';
     if ($cacheid === null && $nochange) {
         $cacheid = unserialize(implode('', file($cacheidfile)));
     }
     $fp = @fopen($cacheidfile, 'wb');
     if (!$fp) {
         $cache_dir = $this->config->get('cache_dir');
         if (!is_dir($cache_dir)) {
             System::mkdir(array('-p', $cache_dir));
             $fp = @fopen($cacheidfile, 'wb');
             if (!$fp) {
                 return false;
             }
         } else {
             return false;
         }
     }
     if ($nochange) {
         fwrite($fp, serialize(array('age' => time(), 'lastChange' => $cacheid['lastChange'])));
         fclose($fp);
         return true;
     } else {
         fwrite($fp, serialize(array('age' => time(), 'lastChange' => $lastmodified)));
     }
     fclose($fp);
     $fp = @fopen($cachefile, 'wb');
     if (!$fp) {
         @unlink($cacheidfile);
         return false;
     }
     fwrite($fp, serialize($contents));
     fclose($fp);
     return true;
 }
开发者ID:kractos26,项目名称:orfeo,代码行数:44,代码来源:REST.php

示例11: generateClasses

 function generateClasses()
 {
     //echo "Generating Class files:        \n";
     $options =& PEAR::getStaticProperty('DB_DataObject', 'options');
     $base = $options['class_location'];
     if (!file_exists($base)) {
         require_once 'System.php';
         System::mkdir(array('-p', $base));
     }
     $class_prefix = $options['class_prefix'];
     if ($extends = @$options['extends']) {
         $this->_extends = $extends;
         $this->_extendsFile = $options['extends_location'];
     }
     foreach ($this->tables as $this->table) {
         $this->table = trim($this->table);
         $this->classname = $class_prefix . preg_replace('/[^A-Z0-9]/i', '_', ucfirst($this->table));
         $i = '';
         $outfilename = "{$base}/" . preg_replace('/[^A-Z0-9]/i', '_', ucfirst($this->table)) . ".php";
         if (file_exists($outfilename)) {
             $i = implode('', file($outfilename));
         }
         $out = $this->_generateClassTable($i);
         $this->debug("writing {$this->classname}\n");
         $fh = fopen($outfilename, "w");
         fputs($fh, $out);
         fclose($fh);
     }
     //echo $out;
 }
开发者ID:BackupTheBerlios,项目名称:urulu-svn,代码行数:30,代码来源:Generator.php

示例12: _assertChannelDir

 /**
  * Make sure the directory where we keep registry files for channels exists
  *
  * @return bool TRUE if directory exists, FALSE if it could not be
  * created
  *
  * @access private
  */
 function _assertChannelDir()
 {
     if (!@is_dir($this->channelsdir)) {
         if (!$this->hasWriteAccess()) {
             return false;
         }
         require_once 'System.php';
         if (!System::mkdir(array('-p', $this->channelsdir))) {
             return $this->raiseError("could not create directory '{$this->channelsdir}'");
         }
     }
     if (!@is_dir($this->channelsdir . DIRECTORY_SEPARATOR . '.alias')) {
         if (!$this->hasWriteAccess()) {
             return false;
         }
         require_once 'System.php';
         if (!System::mkdir(array('-p', $this->channelsdir . DIRECTORY_SEPARATOR . '.alias'))) {
             return $this->raiseError("could not create directory '{$this->channelsdir}/.alias'");
         }
     }
     return true;
 }
开发者ID:hugooluisss,项目名称:SAMAP,代码行数:30,代码来源:Registry.php

示例13: get_filename

 /**
  * Gets the filename that will be used to save these files
  *
  * @param  array   $files The files to be compiled
  * @param  string  $path  The path to save the compiled file to
  * @param  string  $type  The mime type css or js to save the compiled file to
  *
  * @return string
  */
 private static function get_filename($files, $path, $type)
 {
     // Most recently modified file
     $last_modified = 0;
     foreach ($files as $file) {
         $raw_file = self::_get_file_path($file, $type);
         // Check if this file was the most recently modified
         $last_modified = max(filemtime($raw_file), $last_modified);
     }
     if (Theme::$is_admin == TRUE) {
         $path = $path . DS . 'admin';
     }
     //set unqiue filename based on criteria
     $filename = $path . DS . $type . DS . $type . '-' . md5(implode("|", $files)) . $last_modified . '.' . $type;
     $directory = dirname($filename);
     if (!is_dir($directory)) {
         // Recursively create the directories needed for the file
         System::mkdir($directory, 0777, TRUE);
     }
     return $filename;
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:30,代码来源:assets.php

示例14: getFileNameFromTableName

 /**
  * Convert a table name into a file name -> override this if you want a different mapping
  *
  * @access  public
  * @return  string file name;
  */
 function getFileNameFromTableName($table)
 {
     $options =& PEAR::getStaticProperty('DB_DataObject', 'options');
     $base = $options['class_location'];
     if (strpos($base, '%s') !== false) {
         $base = dirname($base);
     }
     if (!file_exists($base)) {
         require_once 'System.php';
         System::mkdir(array('-p', $base));
     }
     if (strpos($options['class_location'], '%s') !== false) {
         $outfilename = sprintf($options['class_location'], preg_replace('/[^A-Z0-9]/i', '_', ucfirst($this->table)));
     } else {
         $outfilename = "{$base}/" . preg_replace('/[^A-Z0-9]/i', '_', ucfirst($this->table)) . ".php";
     }
     return $outfilename;
 }
开发者ID:laiello,项目名称:coopcrucial,代码行数:24,代码来源:Generator.php

示例15: dirname

        $rest_path = '/var/lib/pearweb/rest';
    } else {
        $rest_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'public_html' . DIRECTORY_SEPARATOR . 'rest';
    }
    include_once 'DB.php';
    if (empty($dbh)) {
        $options = array('persistent' => false, 'portability' => DB_PORTABILITY_ALL);
        $dbh =& DB::connect(PEAR_DATABASE_DSN, $options);
    }
    $pear_rest = new pearweb_Channel_REST_Generator($rest_path, $dbh);
}
ob_end_clean();
PEAR::setErrorHandling(PEAR_ERROR_DIE);
require_once 'System.php';
System::rm(array('-r', $rest_path));
System::mkdir(array('-p', $rest_path));
chmod($rest_path, 0777);
echo "Generating Category REST...\n";
include_once 'pear-database-category.php';
foreach (category::listAll() as $category) {
    echo "  {$category['name']}...";
    $pear_rest->saveCategoryREST($category['name']);
    echo "done\n";
}
$pear_rest->saveAllCategoriesREST();
echo "Generating Maintainer REST...\n";
$maintainers = $dbh->getAll('SELECT users.* FROM users, karma WHERE users.handle = karma.user
    AND (karma.level = "pear.dev" OR karma.level = "pear.admin")', array(), DB_FETCHMODE_ASSOC);
foreach ($maintainers as $maintainer) {
    echo "  {$maintainer['handle']}...";
    $pear_rest->saveMaintainerREST($maintainer['handle']);
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:generateREST.php


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