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


PHP Folder::move方法代码示例

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


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

示例1: serve

 protected function serve()
 {
     $this->options['name'] = $this->input->getArgument('name');
     $this->name['machine'] = $this->generateMachineName($this->options['name']);
     $this->name['camel'] = $this->generateCamelName($this->options['name']);
     $path['src'] = PLUGINS_DIR . 'component-generator/' . self::COMPONENT;
     $path['dest'] = PLUGINS_DIR . $this->name['machine'];
     $path['tmp'] = CACHE_DIR . 'tmp/' . self::COMPONENT;
     $replace = array('/{{ COMPONENT }}/' => lcfirst($this->name['camel']), '/{{ COMPONENT NAME }}/' => $this->options['name'], '/{{ COMPONENT CAMEL NAME }}/' => $this->name['camel'], '/{{ COMPONENT MACHINE NAME }}/' => $this->name['machine']);
     // Copy dir to cache/temp
     Folder::copy($path['src'], $path['tmp']);
     // Recursively rewrite file names and contents of all files
     $this->rewriteRecursive($path['tmp'], array_keys($replace), array_values($replace));
     // Move dir to rest
     Folder::move($path['tmp'], $path['dest']);
     // Success message
 }
开发者ID:ellioseven,项目名称:grav-plugin-modular-component-generator,代码行数:17,代码来源:ScaffoldCommand.php

示例2: doRelocation

 /**
  * Moves or copies the page in filesystem.
  *
  * @internal
  */
 protected function doRelocation($reorder)
 {
     if (empty($this->_original)) {
         return;
     }
     // Do reordering.
     if ($reorder && $this->order() != $this->_original->order()) {
         /** @var Pages $pages */
         $pages = self::getGrav()['pages'];
         $parent = $this->parent();
         // Extract visible children from the parent page.
         $list = array();
         /** @var Page $page */
         foreach ($parent->children()->visible() as $page) {
             if ($page->order()) {
                 $list[$page->slug] = $page->path();
             }
         }
         // If page was moved, take it out of the list.
         if ($this->_action == 'move') {
             unset($list[$this->slug()]);
         }
         $list = array_values($list);
         // Then add it back to the new location (if needed).
         if ($this->order()) {
             array_splice($list, min($this->order() - 1, count($list)), 0, array($this->path()));
         }
         // Reorder all moved pages.
         foreach ($list as $order => $path) {
             if ($path == $this->path()) {
                 // Handle current page; we do want to change ordering number, but nothing else.
                 $this->order($order + 1);
             } else {
                 // Handle all the other pages.
                 $page = $pages->get($path);
                 if ($page && $page->exists() && $page->order() != $order + 1) {
                     $page = $page->move($parent);
                     $page->order($order + 1);
                     $page->save(false);
                 }
             }
         }
     }
     if ($this->_action == 'move' && $this->_original->exists()) {
         Folder::move($this->_original->path(), $this->path());
     }
     if ($this->_action == 'copy' && $this->_original->exists()) {
         Folder::copy($this->_original->path(), $this->path());
     }
     if ($this->name() != $this->_original->name()) {
         $path = $this->path();
         if (is_file($path . '/' . $this->_original->name())) {
             rename($path . '/' . $this->_original->name(), $path . '/' . $this->name());
         }
     }
     $this->_action = null;
     $this->_original = null;
 }
开发者ID:realitygaps,项目名称:grav_ynh,代码行数:63,代码来源:Page.php

示例3: sophisticatedInstall

 /**
  * @param \ZipArchive $zip
  * @param             $install_path
  * @param             $tmp
  *
  * @return bool
  */
 public static function sophisticatedInstall(\ZipArchive $zip, $install_path, $tmp)
 {
     for ($i = 0, $l = $zip->numFiles; $i < $l; $i++) {
         $filename = $zip->getNameIndex($i);
         $fileinfo = pathinfo($filename);
         $depth = count(explode(DS, rtrim($filename, '/')));
         if ($depth > 2) {
             continue;
         }
         $path = $install_path . DS . $fileinfo['basename'];
         if (is_link($path)) {
             continue;
         } else {
             if (is_dir($path)) {
                 Folder::delete($path);
                 Folder::move($tmp . DS . $filename, $path);
                 if ($fileinfo['basename'] == 'bin') {
                     foreach (glob($path . DS . '*') as $file) {
                         @chmod($file, 0755);
                     }
                 }
             } else {
                 @unlink($path);
                 @copy($tmp . DS . $filename, $path);
             }
         }
     }
     return true;
 }
开发者ID:ulilu,项目名称:grav-toctoc,代码行数:36,代码来源:Installer.php

示例4: sophisticatedInstall

 /**
  * @param             $source_path
  * @param             $install_path
  *
  * @return bool
  */
 public static function sophisticatedInstall($source_path, $install_path)
 {
     foreach (new \DirectoryIterator($source_path) as $file) {
         if ($file->isLink() || $file->isDot()) {
             continue;
         }
         $path = $install_path . DS . $file->getBasename();
         if ($file->isDir()) {
             Folder::delete($path);
             Folder::move($file->getPathname(), $path);
             if ($file->getBasename() == 'bin') {
                 foreach (glob($path . DS . '*') as $bin_file) {
                     @chmod($bin_file, 0755);
                 }
             }
         } else {
             @unlink($path);
             @copy($file->getPathname(), $path);
         }
     }
     return true;
 }
开发者ID:indigo423,项目名称:blog.no42.org,代码行数:28,代码来源:Installer.php


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