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


PHP Folder::copy方法代码示例

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


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

示例1: initialAppPath

 /**
  * Make sure if the $appPath exists and copy the skel to there
  * @param string $appPath
  */
 public function initialAppPath($appPath)
 {
     App::uses('Folder', 'Utility');
     $fh = new Folder();
     if (file_exists($appPath)) {
         if (false === $fh->delete($appPath)) {
             $this->errorMessage = __('Target path exists. But the program could not delete the folder automatically');
             return false;
         } else {
             $this->tasks[] = array('title' => __('Target path exists. Delete the old folders.'), 'operactions' => $fh->messages());
         }
     }
     /*
      * Copy the skelecton of the application
      */
     $fh->copy(array('to' => $appPath, 'from' => VENDORS . 'olc_baker' . DS . 'skels' . DS . 'default', 'mode' => 0777));
     $errors1 = $fh->errors();
     $fh->copy(array('to' => $appPath . DS . 'cake2' . DS . 'lib', 'from' => CAKE_CORE_INCLUDE_PATH, 'mode' => 0777));
     $errors2 = $fh->errors();
     if (!empty($errors1) || !empty($errors2)) {
         $this->errorMessage = __('The program could not copy files to the folder automatically');
         return false;
     } else {
         $this->tasks[] = array('title' => __('Copy the skelecton of application to the target path'), 'operactions' => $fh->messages());
     }
     return true;
 }
开发者ID:kiang,项目名称:olc_baker,代码行数:31,代码来源:Project.php

示例2: addShopToFolder

 /**
  * add shop to folder
  * 
  */
 function addShopToFolder()
 {
     $name = @$this->request->data['name'];
     $shop_id = @$this->request->data['shop_id'];
     if (!$shop_id || !$name) {
         return $this->responseng('faild to add shop.');
     }
     $dataFolder = array("user_id" => $this->user_id, "name" => $name, "type_folder" => intval(@$this->request->data['type_folder']));
     $ret = $this->FolderUser->save($dataFolder);
     $folder_id_old = @$this->request->data["older_folder_id"];
     $datashopFolder = array("folder_id" => $ret["FolderUser"]["id"], "shop_id" => $shop_id, "rank" => 1, "status" => NO_MY_FOLDER);
     $result = $this->FolderShop->save($datashopFolder);
     App::uses('Folder', 'Utility');
     $folder = new Folder();
     if (!empty($folder_id_old)) {
         $oldFolder = $this->FolderUser->findById($folder_id_old);
         $newFolder = $ret;
         $path = WWW_ROOT . 'shops' . DS . $oldFolder["FolderUser"]["user_id"] . DS . $oldFolder["FolderUser"]["id"] . DS . $shop_id;
         $newPath = WWW_ROOT . 'shops' . DS . $newFolder["FolderUser"]["user_id"] . DS . $newFolder["FolderUser"]["id"] . DS . $result["FolderShop"]["shop_id"];
         if (is_dir($path)) {
             if (!is_dir($newPath)) {
                 $folder->create($newPath);
             }
             $folder->copy(array('to' => $newPath, 'from' => $path, 'mode' => 0777));
         }
     }
     if ($result) {
         return $this->responseOk();
     }
     return $this->responseng('can not save data');
 }
开发者ID:Quang2727,项目名称:Kaopass,代码行数:35,代码来源:ShopsController.php

示例3: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $Folder = new Folder(APP . 'Plugin' . DS . 'Example');
     $Folder->copy(TESTS . 'test_app' . DS . 'Plugin' . DS . 'Example');
     $this->Setting = ClassRegistry::init('Settings.Setting');
 }
开发者ID:laiello,项目名称:plankonindia,代码行数:12,代码来源:ExtShellTest.php

示例4: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $Folder = new Folder(APP . 'Plugin' . DS . 'Example');
     $Folder->copy(CakePlugin::path('Croogo') . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'Example');
     $this->Setting = ClassRegistry::init('Settings.Setting');
 }
开发者ID:Demired,项目名称:CakeWX,代码行数:12,代码来源:ExtShellTest.php

示例5: copyAssets

 /**
  * Copies folders
  * 
  * @return void
  */
 public function copyAssets()
 {
     foreach (Helper::ensureArray($this->config['copy']) as $folder) {
         $folder = str_replace('{theme}', Config::getTheme(), $folder);
         $full_from_path = Path::assemble(BASE_PATH, $folder);
         $full_to_path = Path::assemble(BASE_PATH, $this->config['destination'], $folder);
         Folder::copy($full_from_path, $full_to_path);
     }
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:14,代码来源:core.generator.php

示例6: main

 public function main()
 {
     $Folder = new Folder(dirname(dirname(dirname(__FILE__))) . DS . "features");
     $this->out("copy " . $Folder->pwd() . " to Cake Root...");
     $Folder->copy(array('to' => ROOT . DS . "features"));
     $File = new File(dirname(__FILE__) . DS . "behat.yml.default");
     $this->out("copy " . $File->name() . " to App/Config...");
     $File->copy(APP . DS . "Config" . DS . "behat.yml");
 }
开发者ID:nojimage,项目名称:Bdd,代码行数:9,代码来源:InitShell.php

示例7: signup

 public function signup()
 {
     if (!empty($this->data)) {
         $data = $this->data;
         $data['User']['isActivated'] = 1;
         $data['User']['password'] = md5($data['User']['password']);
         if ($this->User->save($data)) {
             $originaldir = new Folder(WWW_ROOT . 'files/books/asper/original', true, 0755);
             $originaldir->copy(WWW_ROOT . 'files/books/asper/' . $data['User']['username'] . '/');
             $this->Session->write('username', $data['User']['username']);
             $this->Session->setFlash("User Saved!");
             $this->redirect('/users');
         }
     }
     $this->set('title_for_layout', 'User Signup');
     $this->render("signup");
 }
开发者ID:rajibul,项目名称:editablebook,代码行数:17,代码来源:UsersController.php

示例8: deployAdminAssets

 /**
  * テーマに管理システム用アセットを配置する
  * 
  * @return boolean
  */
 public function deployAdminAssets()
 {
     $viewPath = WWW_ROOT;
     $adminCss = BASER_WEBROOT . 'css' . DS . 'admin';
     $adminJs = BASER_WEBROOT . 'js' . DS . 'admin';
     $adminImg = BASER_WEBROOT . 'img' . DS . 'admin';
     $css = $viewPath . 'css' . DS . 'admin';
     $js = $viewPath . 'js' . DS . 'admin';
     $img = $viewPath . 'img' . DS . 'admin';
     $result = true;
     $Folder = new Folder();
     if (!$Folder->copy(array('from' => $adminCss, 'to' => $css, 'mode' => 0777))) {
         $result = false;
     }
     if (!$Folder->copy(array('from' => $adminJs, 'to' => $js, 'mode' => 0777))) {
     }
     if (!$Folder->copy(array('from' => $adminImg, 'to' => $img, 'mode' => 0777))) {
         $result = false;
     }
     return $result;
 }
开发者ID:naow9y,项目名称:basercms,代码行数:26,代码来源:BcManagerComponent.php

示例9: testCopyWithOverwrite

 /**
  * testCopyWithOverwrite
  *
  * Verify that subdirectories existing in both destination and source directory
  * are overwritten/replaced recursively.
  *
  * @return void
  */
 public function testCopyWithOverwrite()
 {
     extract($this->_setupFilesystem());
     $Folder = new Folder($folderOne);
     $result = $Folder->copy(array('to' => $folderThree, 'scheme' => Folder::OVERWRITE));
     $this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
     $this->assertTrue(file_exists($folderThree . DS . 'folderA' . DS . 'fileA.php'));
     $Folder = new Folder($folderTwo);
     $result = $Folder->copy(array('to' => $folderThree, 'scheme' => Folder::OVERWRITE));
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderThree . DS . 'folderA' . DS . 'fileA.php'));
     $Folder = new Folder($folderOne);
     unlink($fileOneA);
     $result = $Folder->copy(array('to' => $folderThree, 'scheme' => Folder::OVERWRITE));
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
     $this->assertTrue(file_exists($folderThree . DS . 'file2.php'));
     $this->assertTrue(!file_exists($folderThree . DS . 'folderA' . DS . 'fileA.php'));
     $this->assertTrue(file_exists($folderThree . DS . 'folderB' . DS . 'fileB.php'));
     $Folder = new Folder($path);
     $Folder->delete();
 }
开发者ID:yuuicchan0912,项目名称:sample2,代码行数:30,代码来源:FolderTest.php

示例10: _bake

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  *
  * @param string $path Project path
  * @param string $skel Path to copy from
  * @param string $skip array of directories to skip when copying
  * @return boolean
  */
 protected function _bake($path, $skel, $skip = array())
 {
     $Folder = new Folder($skel);
     $app = basename($path);
     if (!$Folder->copy(array('to' => $path, 'skip' => $skip))) {
         $this->err(__d('cake_console', "<error>Could not create</error> '%s' properly.", $app));
         return false;
     }
     foreach ($Folder->messages() as $message) {
         $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE);
     }
     return true;
 }
开发者ID:rikkeisoft,项目名称:cakephp2,代码行数:23,代码来源:ProjectShell.php

示例11: bake

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  * A default home page will be added, and the tmp file storage will be chmod'ed to 0777.
  *
  * @param string $path Project path
  * @param string $skel Path to copy from
  * @param string $skip array of directories to skip when copying
  * @access private
  */
 function bake($path, $skel = null, $skip = array('empty'))
 {
     if (!$skel) {
         $skel = $this->params['skel'];
     }
     while (!$skel) {
         $skel = $this->in(__("What is the path to the directory layout you wish to copy?\nExample: %s", APP, null, ROOT . DS . 'myapp' . DS));
         if ($skel == '') {
             $this->err(__('The directory path you supplied was empty. Please try again.'));
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in(__('Directory path does not exist please choose another:'));
             }
         }
     }
     $app = basename($path);
     $this->out(__('<info>Skel Directory</info>: ') . $skel);
     $this->out(__('<info>Will be copied to</info>: ') . $path);
     $this->hr();
     $looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
     if (strtolower($looksGood) == 'y') {
         $Folder = new Folder($skel);
         if (!empty($this->params['empty'])) {
             $skip = array();
         }
         if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
             $this->hr();
             $this->out(__('<success>Created:</success> %s in %s', $app, $path));
             $this->hr();
         } else {
             $this->err(__("<error>Could not create</error> '%s' properly.", $app));
             return false;
         }
         foreach ($Folder->messages() as $message) {
             $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE);
         }
         return true;
     } elseif (strtolower($looksGood) == 'q') {
         $this->out(__('Bake Aborted.'));
     } else {
         $this->execute(false);
         return false;
     }
 }
开发者ID:no2key,项目名称:Web-Framework-Benchmark,代码行数:55,代码来源:project.php

示例12: redirectEditForm

 /**
  * メールフォーム編集画面にリダイレクトする
  * 
  * @param string $template
  * @return void
  * @access public
  */
 function redirectEditForm($template)
 {
     $path = 'mail' . DS . $template;
     $target = WWW_ROOT . 'themed' . DS . $this->siteConfigs['theme'] . DS . $path;
     $sorces = array(BASER_PLUGINS . 'mail' . DS . 'views' . DS . $path);
     if ($this->siteConfigs['theme']) {
         if (!file_exists($target . DS . 'index' . $this->ext)) {
             foreach ($sorces as $source) {
                 if (is_dir($source)) {
                     $folder = new Folder();
                     $folder->create(dirname($target), 0777);
                     $folder->copy(array('from' => $source, 'to' => $target, 'chmod' => 0777, 'skip' => array('_notes')));
                     break;
                 }
             }
         }
         $path = str_replace(DS, '/', $path);
         $this->redirect(array('plugin' => null, 'mail' => false, 'prefix' => false, 'controller' => 'theme_files', 'action' => 'edit', $this->siteConfigs['theme'], 'etc', $path . '/index' . $this->ext));
     } else {
         $this->Session->setFlash('現在、「テーマなし」の場合、管理画面でのテンプレート編集はサポートされていません。');
         $this->redirect(array('action' => 'index'));
     }
 }
开发者ID:ryuring,项目名称:basercms,代码行数:30,代码来源:mail_contents_controller.php

示例13: while

 /**
  * テーマをコピーする
  *
  * @param string $theme
  * @return void
  * @access public
  */
 function admin_copy($theme)
 {
     if (!$theme) {
         $this->notFound();
     }
     $path = WWW_ROOT . 'themed' . DS . $theme;
     $newPath = $path . '_copy';
     while (true) {
         if (!is_dir($newPath)) {
             break;
         }
         $newPath .= '_copy';
     }
     $folder = new Folder();
     $folder->copy(array('from' => $path, 'to' => $newPath, 'mode' => 0777, 'skip' => array('_notes')));
     $this->Session->setFlash('テーマ「' . $theme . '」をコピーしました。');
     $this->redirect(array('action' => 'index'));
 }
开发者ID:nazo,项目名称:phpcondo,代码行数:25,代码来源:themes_controller.php

示例14: saveShopFolder

 /**
  * save shop in folder
  * 
  */
 function saveShopFolder($saveFolder, $shop_id, $call, $buffer_Folder)
 {
     $dataNotfi = array("user_id" => $this->user_id, "folder_id" => $saveFolder["FolderUser"]["id"], "type_messages" => CREATED);
     $this->Notification->saveNoti($dataNotfi);
     App::uses('Folder', 'Utility');
     $folder = new Folder();
     $folder_id_old = @$this->request->data["older_folder_id"];
     if (!empty($folder_id_old) && !empty($shop_id)) {
         $oldFolder = $this->FolderUser->findById($folder_id_old);
         $path = WWW_ROOT . 'shops' . DS . $oldFolder["FolderUser"]["user_id"] . DS . $oldFolder["FolderUser"]["id"] . DS . $shop_id;
         $newPath = WWW_ROOT . 'shops' . DS . $saveFolder["FolderUser"]["user_id"] . DS . $saveFolder["FolderUser"]["id"] . DS . $shop_id;
         if (is_dir($path)) {
             if (!is_dir($newPath)) {
                 $folder->create($newPath);
             }
             $folder->copy(array('to' => $newPath, 'from' => $path, 'mode' => 0777));
         }
     }
     if (!$this->copyFoler($buffer_Folder, $saveFolder, $this->new_shop)) {
         return false;
     }
     if ($call == UPLOAD) {
         if ($this->uploadImageShop($saveFolder["FolderUser"]["id"], @$this->request->data['shop_id'])) {
             return $saveFolder["FolderUser"]["id"];
         }
         return false;
     } else {
         if ($call == MOVE_SHOP || $call == UPDATE || $call == ADDSHOP || $call == CUT_SHOP || $call == CHANGE_FOLDER || $call == RENAME) {
             return $saveFolder["FolderUser"]["id"];
         } else {
             if ($call == ADD_INPUT_SHOP) {
                 return array("shop_id" => $shop_id, "folder_id" => $saveFolder["FolderUser"]["id"]);
             }
         }
     }
     return true;
 }
开发者ID:Quang2727,项目名称:Kaopass,代码行数:41,代码来源:FoldersController.php

示例15: Language

// but no output of error message because of safe mode
@set_time_limit(600);
echo 'Start with installation ...<br />';
// create language and language data object to handle translations
$gL10n = new Language();
$gLanguageData = new LanguageData($getLanguage);
$gL10n->addLanguageData($gLanguageData);
$gL10n->addLanguagePath(SERVER_PATH . '/demo_data/languages');
// copy content of folder adm_my_files to productive folder
$srcFolder = SERVER_PATH . '/demo_data/adm_my_files';
$newFolder = SERVER_PATH . '/adm_my_files';
$myFilesFolder = new Folder($srcFolder);
$b_return = $myFilesFolder->delete($newFolder . '/backup');
$b_return = $myFilesFolder->delete($newFolder . '/download');
$b_return = $myFilesFolder->delete($newFolder . '/photos');
$b_return = $myFilesFolder->copy($newFolder);
if (!$b_return) {
    echo '<p style="color: #cc0000;">Folder <strong>adm_my_files</strong> is not writable.<br />
    No files could be copied to that folder.</p>';
    exit;
}
echo 'Folder <strong>adm_my_files</strong> was successfully copied.<br />';
// connect to database
$db = Database::createDatabaseObject($gDbType);
$connection = $db->connect($g_adm_srv, $g_adm_usr, $g_adm_pw, $g_adm_db);
if ($gDbType === 'mysql') {
    // disable foreign key checks for mysql, so tables can easily deleted
    $sql = 'SET foreign_key_checks = 0 ';
    $db->query($sql);
}
$filename = 'db.sql';
开发者ID:bash-t,项目名称:admidio,代码行数:31,代码来源:build.php


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