copy() публичный Метод

Copies the directory to a new location
public copy ( string $to ) : boolean
$to string
Результат boolean
Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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');
 }
Пример #3
0
 /**
  * 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');
 }
Пример #4
0
 /**
  * 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');
 }
 /**
  * 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);
     }
 }
Пример #6
0
 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");
 }
Пример #7
0
 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");
 }
Пример #8
0
 /**
  * テーマに管理システム用アセットを配置する
  * 
  * @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;
 }
Пример #9
0
 /**
  * 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();
 }
Пример #10
0
 /**
  * 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;
 }
Пример #11
0
 /**
  * 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;
     }
 }
Пример #12
0
 /**
  * メールフォーム編集画面にリダイレクトする
  * 
  * @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'));
     }
 }
Пример #13
0
 /**
  * テーマをコピーする
  *
  * @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'));
 }
Пример #14
0
 /**
  * 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;
 }
Пример #15
0
// 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';
Пример #16
0
 /**
  * Copy Folder Temp To image_dir
  *
  * @param  string  $username , string  $image_dir
  * @return void
  * @author Alongkot <*****@*****.**>
  * @since 15 July 2015
  */
 private function is_copyTempFolder($username, $image_dir)
 {
     $pathTemp = WWW_ROOT . 'uploads/blog/' . $username . '_temp/';
     $pathBlogImage = WWW_ROOT . 'uploads/blog/' . $image_dir;
     $folderTemp = new Folder($pathTemp);
     if (!is_null($folderTemp->path)) {
         $folderTemp->copy($pathBlogImage);
         $folderTemp->copy(array('to' => $pathBlogImage, 'mode' => 0755, 'scheme' => Folder::SKIP, 'recursive' => true));
         $folderTemp->delete();
     }
 }
Пример #17
0
 /**
  * テーマを配置する
  *
  * @param string $theme
  * @return boolean
  * @access public
  */
 function deployTheme($theme = 'demo')
 {
     $targetPath = WWW_ROOT . 'themed' . DS . $theme;
     $sourcePath = BASER_CONFIGS . 'theme' . DS . $theme;
     $folder = new Folder();
     $folder->delete($targetPath);
     if ($folder->copy(array('to' => $targetPath, 'from' => $sourcePath, 'mode' => 0777, 'skip' => array('_notes')))) {
         if ($folder->create($targetPath . DS . 'pages', 0777)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Пример #18
0
 /**
  * ブログテンプレート編集画面にリダイレクトする
  * 
  * @param string $template
  * @return void
  * @access public
  */
 public function redirectEditBlog($template)
 {
     $path = 'Blog' . DS . $template;
     $target = WWW_ROOT . 'theme' . DS . $this->siteConfigs['theme'] . DS . $path;
     $sources = array(BASER_PLUGINS . 'Blog' . DS . 'View' . DS . $path);
     if ($this->siteConfigs['theme']) {
         if (!file_exists($target . DS . 'index' . $this->ext)) {
             foreach ($sources 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_merge(array('plugin' => null, 'controller' => 'theme_files', 'action' => 'edit', $this->siteConfigs['theme'], 'etc'), explode('/', $path . '/index' . $this->ext)));
     } else {
         $this->setMessage('現在、「テーマなし」の場合、管理画面でのテンプレート編集はサポートされていません。', true);
         $this->redirect(array('action' => 'index'));
     }
 }
Пример #19
0
 /**
  * コアファイルのフォルダを現在のテーマにコピーする
  *
  * @return void
  * @access public
  */
 public function admin_copy_folder_to_theme()
 {
     $args = $this->_parseArgs(func_get_args());
     extract($args);
     if (!isset($this->_tempalteTypes[$type])) {
         $this->notFound();
     }
     if ($type != 'etc') {
         if ($plugin && $assets) {
             $themePath = WWW_ROOT . 'theme' . DS . $this->siteConfigs['theme'] . DS . $plugin . DS . $type . DS;
         } else {
             $themePath = WWW_ROOT . 'theme' . DS . $this->siteConfigs['theme'] . DS . $type . DS;
         }
         if ($path) {
             $themePath .= $path . DS;
         }
     } else {
         $themePath = WWW_ROOT . 'theme' . DS . $this->siteConfigs['theme'] . DS . $path . DS;
     }
     $folder = new Folder();
     $folder->create(dirname($themePath), 0777);
     if ($folder->copy(array('from' => $fullpath, 'to' => $themePath, 'chmod' => 0777, 'skip' => array('_notes')))) {
         $_themePath = str_replace(ROOT, '', $themePath);
         $this->setMessage('コアフォルダ ' . basename($path) . ' を テーマ ' . Inflector::camelize($this->siteConfigs['theme']) . ' の次のパスとしてコピーしました。<br />' . $_themePath);
         // 現在のテーマにリダイレクトする場合、混乱するおそれがあるのでとりあえずそのまま
         //$this->redirect(array('action' => 'edit', $this->siteConfigs['theme'], $type, $path));
     } else {
         $this->setMessage('コアフォルダ ' . basename($path) . ' のコピーに失敗しました。', true);
     }
     $this->redirect(array_merge(array('action' => 'view_folder', $theme, $plugin, $type), explode('/', $path)));
 }
 /**
  * testCopy method
  *
  * Verify that directories and files are copied recursively
  * even if the destination directory already exists.
  * Subdirectories existing in both destination and source directory
  * are skipped and not merged or overwritten.
  *
  * @return void
  */
 public function testCopy()
 {
     $path = TMP . 'folder_test';
     $folder1 = $path . DS . 'folder1';
     $folder2 = $folder1 . DS . 'folder2';
     $folder3 = $path . DS . 'folder3';
     $file1 = $folder1 . DS . 'file1.php';
     $file2 = $folder2 . DS . 'file2.php';
     new Folder($path, true);
     new Folder($folder1, true);
     new Folder($folder2, true);
     new Folder($folder3, true);
     touch($file1);
     touch($file2);
     $Folder = new Folder($folder1);
     $result = $Folder->copy($folder3);
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
     $this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
     $Folder = new Folder($folder3);
     $Folder->delete();
     $Folder = new Folder($folder1);
     $result = $Folder->copy($folder3);
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
     $this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
     $Folder = new Folder($folder3);
     $Folder->delete();
     new Folder($folder3, true);
     new Folder($folder3 . DS . 'folder2', true);
     file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched');
     $Folder = new Folder($folder1);
     $result = $Folder->copy($folder3);
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
     $this->assertEquals(file_get_contents($folder3 . DS . 'folder2' . DS . 'file2.php'), 'untouched');
     $Folder = new Folder($path);
     $Folder->delete();
 }
Пример #21
0
 /**
  * テーマをコピーする
  *
  * @param string $theme
  * @return boolean
  * @access public
  */
 protected function _copy($theme)
 {
     $basePath = WWW_ROOT . 'theme' . DS;
     $newTheme = $theme . '_copy';
     while (true) {
         if (!is_dir($basePath . $newTheme)) {
             break;
         }
         $newTheme .= '_copy';
     }
     $folder = new Folder();
     if ($folder->copy(array('from' => $basePath . $theme, 'to' => $basePath . $newTheme, 'mode' => 0777, 'skip' => array('_notes')))) {
         $this->Theme->saveDblog('テーマ「' . $theme . '」をコピーしました。');
         return $this->_loadThemeInfo($newTheme);
     } else {
         return false;
     }
 }
 /**
  * testCopy method
  *
  * Verify that directories and files are copied recursively
  * even if the destination directory already exists.
  * Subdirectories existing in both destination and source directory
  * are skipped and not merged or overwritten.
  *
  * @return void
  */
 public function testCopy()
 {
     $path = TMP . 'folder_test';
     $folderOne = $path . DS . 'folder1';
     $folderTwo = $folderOne . DS . 'folder2';
     $folderThree = $path . DS . 'folder3';
     $fileOne = $folderOne . DS . 'file1.php';
     $fileTwo = $folderTwo . DS . 'file2.php';
     new Folder($path, true);
     new Folder($folderOne, true);
     new Folder($folderTwo, true);
     new Folder($folderThree, true);
     touch($fileOne);
     touch($fileTwo);
     $Folder = new Folder($folderOne);
     $result = $Folder->copy($folderThree);
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
     $this->assertTrue(file_exists($folderThree . DS . 'folder2' . DS . 'file2.php'));
     $Folder = new Folder($folderThree);
     $Folder->delete();
     $Folder = new Folder($folderOne);
     $result = $Folder->copy($folderThree);
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
     $this->assertTrue(file_exists($folderThree . DS . 'folder2' . DS . 'file2.php'));
     $Folder = new Folder($folderThree);
     $Folder->delete();
     new Folder($folderThree, true);
     new Folder($folderThree . DS . 'folder2', true);
     file_put_contents($folderThree . DS . 'folder2' . DS . 'file2.php', 'untouched');
     $Folder = new Folder($folderOne);
     $result = $Folder->copy($folderThree);
     $this->assertTrue($result);
     $this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
     $this->assertEquals('untouched', file_get_contents($folderThree . DS . 'folder2' . DS . 'file2.php'));
     $Folder = new Folder($path);
     $Folder->delete();
 }
Пример #23
0
 /**
  * linkTheme method
  *
  * Download a theme from jqueryui and put it in the webroot
  *
  * @TODO tie in with mi_panel so the theme colors are taken from the panel?
  * @return void
  * @access protected
  */
 function _linkTheme()
 {
     if (file_exists(TMP . 'theme.lock')) {
         while (file_exists(TMP . 'theme.lock')) {
             sleep(1);
         }
     }
     if (file_exists(WWW_ROOT . $this->params['url']['url'])) {
         return true;
     } elseif (file_exists(WWW_ROOT . 'js' . DS . 'theme' . DS . 'jquery.ui.theme.css')) {
         /*
         			   The theme does exist - so it's likely a bad request
         */
         touch(WWW_ROOT . $this->params['url']['url']);
         return false;
     }
     touch(TMP . 'theme.lock');
     $zipPath = TMP . 'theme' . DS . 'theme.zip';
     if (!is_dir(dirname($zipPath))) {
         $downloaded = true;
         $url = 'http://jqueryui.com/download';
         App::import('Core', 'HttpSocket');
         $HttpSocket = new HttpSocket();
         $out = $HttpSocket->post($url, array('download' => true, 'theme' => '?ffDefault=Verdana,Arial,sans-serif&' . 'fwDefault=normal&' . 'fsDefault=1.1em&' . 'cornerRadius=4px&' . 'bgColorHeader=cccccc&' . 'bgTextureHeader=03_highlight_soft.png&' . 'bgImgOpacityHeader=75&' . 'borderColorHeader=aaaaaa&' . 'fcHeader=222222&' . 'iconColorHeader=222222&' . 'bgColorContent=ffffff&' . 'bgTextureContent=01_flat.png&' . 'bgImgOpacityContent=75&' . 'borderColorContent=aaaaaa&' . 'fcContent=222222&' . 'iconColorContent=222222&' . 'bgColorDefault=e6e6e6&' . 'bgTextureDefault=02_glass.png&' . 'bgImgOpacityDefault=75&' . 'borderColorDefault=d3d3d3&' . 'fcDefault=555555&' . 'iconColorDefault=888888&' . 'bgColorHover=dadada&' . 'bgTextureHover=02_glass.png&' . 'bgImgOpacityHover=75&' . 'borderColorHover=999999&' . 'fcHover=212121&' . 'iconColorHover=454545&' . 'bgColorActive=ffffff&' . 'bgTextureActive=02_glass.png&' . 'bgImgOpacityActive=65&' . 'borderColorActive=aaaaaa&' . 'fcActive=212121&' . 'iconColorActive=454545&' . 'bgColorHighlight=fbf9ee&' . 'bgTextureHighlight=02_glass.png&' . 'bgImgOpacityHighlight=55&' . 'borderColorHighlight=fcefa1&' . 'fcHighlight=363636&' . 'iconColorHighlight=2e83ff&' . 'bgColorError=fef1ec&' . 'bgTextureError=05_inset_soft.png&' . 'bgImgOpacityError=95&' . 'borderColorError=cd0a0a&' . 'fcError=cd0a0a&' . 'iconColorError=cd0a0a&' . 'bgColorOverlay=aaaaaa&' . 'bgTextureOverlay=01_flat.png&' . 'bgImgOpacityOverlay=0&' . 'opacityOverlay=30&' . 'bgColorShadow=aaaaaa&' . 'bgTextureShadow=01_flat.png&' . 'bgImgOpacityShadow=0&' . 'opacityShadow=30&' . 'thicknessShadow=8px&' . 'offsetTopShadow=-8px&' . 'offsetLeftShadow=-8px&' . 'cornerRadiusShadow=8px', 'scope' => '', 't-name' => 'custom-theme', 'ui-version' => '1.8.5'));
         $aFolder = new Folder(dirname($zipPath), true);
         $zipFile = new File($zipPath);
         $zipFile->write($out);
         $this->_exec('cd ' . dirname($zipPath) . ' && unzip ' . $zipPath, $out);
     } else {
         $aFolder = new Folder(dirname($zipPath));
     }
     if (!is_dir(dirname($zipPath))) {
         unlink(TMP . 'theme.lock');
         return false;
     }
     $aFolder->copy(array('from' => TMP . str_replace('/', DS, 'theme/development-bundle/themes/custom-theme'), 'to' => WWW_ROOT . 'js' . DS . 'theme'));
     if (is_dir(WWW_ROOT . 'js' . DS . 'theme')) {
         if (file_exists(WWW_ROOT . 'js' . DS . 'theme' . DS . 'jquery-ui-1.7.2.custom.css')) {
             unlink(WWW_ROOT . 'js' . DS . 'theme' . DS . 'jquery-ui-1.7.2.custom.css');
         }
         if (!empty($downloaded)) {
             $this->_exec('rm -rf ' . $zipPath);
         }
         unlink(TMP . 'theme.lock');
         return true;
     }
     unlink(TMP . 'theme.lock');
     return false;
 }
Пример #24
0
Configure::write(APP_NAME . '.logging.debug.path', $datastoreLogs);
Configure::write(APP_NAME . '.logging.error.path', $datastoreLogs);
// Ignore datastore when using the AppSetup shell
if (php_sapi_name() == "cli" && (in_array('orca_app_setup.app_setup', env('argv')) || in_array('orca_app_setup.AppSetup', env('argv')) || in_array('OrcaAppSetup.app_setup', env('argv')) || in_array('OrcaAppSetup.AppSetup', env('argv')))) {
    return true;
}
// Check if the datastore folder exists, if not, create the full structure
if (!file_exists($datastorePath)) {
    // Only auto-create it when in debug mode
    if (!Configure::read('debug')) {
        die(__('Datastore folder does not exist at %s', $datastorePath));
    }
    try {
        // Copy datastore folder structure from template structure
        $datastoreTemplate = new Folder(APP . 'Config' . DS . 'templates' . DS . 'datastore');
        $datastoreTemplate->copy(array('to' => $datastorePath, 'mode' => 0755));
    } catch (Exception $e) {
        die(__('Could not create datastore folder structure at %s', $datastorePath));
    }
    if (!file_exists($datastorePath)) {
        die(__('Could not create datastore at ' . $datastorePath));
    }
    die(__('Missing datastore folder structure automatically created. ' . 'Please setup local configuration at ' . $datastoreConfig));
}
// Setup datastore configuration reader
Configure::config('datastore', new PhpReader($datastoreConfig));
// Read environment name to load environment specific defaults
$envFile = $datastoreConfig . 'environment.php';
if (!file_exists($envFile)) {
    die(__('No environment config file found at %s', $envFile));
}
 public function _add_data($cad_id = NULL, $data = NULL)
 {
     $this->ChangeAdditionDeletionRequest->MasterListOfFormat->read(null, $data['ChangeAdditionDeletionRequest']['master_list_of_format']);
     $this->ChangeAdditionDeletionRequest->MasterListOfFormat->save($data['NewMasterListOfFormat'], false);
     $this->loadModel('DocumentAmendmentRecordSheet');
     $ifExist = $this->DocumentAmendmentRecordSheet->find('first', array('conditions' => array('DocumentAmendmentRecordSheet.change_addition_deletion_request_id' => $cad_id)));
     if (!$ifExist) {
         $this->DocumentAmendmentRecordSheet->create();
         $sheetData = null;
         $sheetData['DocumentAmendmentRecordSheet']['request_from'] = $data['ChangeAdditionDeletionRequest']['request_from'];
         $sheetData['DocumentAmendmentRecordSheet']['branch_id'] = $data['ChangeAdditionDeletionRequest']['branch_id'];
         $sheetData['DocumentAmendmentRecordSheet']['department_id'] = $data['ChangeAdditionDeletionRequest']['department_id'];
         $sheetData['DocumentAmendmentRecordSheet']['employee_id'] = $data['ChangeAdditionDeletionRequest']['employee_id'];
         $sheetData['DocumentAmendmentRecordSheet']['others'] = $data['ChangeAdditionDeletionRequest']['others'];
         $sheetData['DocumentAmendmentRecordSheet']['suggestion_form_id'] = $data['ChangeAdditionDeletionRequest']['suggestion_form_id'];
         $sheetData['DocumentAmendmentRecordSheet']['customer_id'] = $data['ChangeAdditionDeletionRequest']['customer_id'];
         $sheetData['DocumentAmendmentRecordSheet']['master_list_of_format'] = $data['ChangeAdditionDeletionRequest']['master_list_of_format'];
         $sheetData['DocumentAmendmentRecordSheet']['document_title'] = $data['MasterListOfFormat']['title'];
         $sheetData['DocumentAmendmentRecordSheet']['document_number'] = $data['MasterListOfFormat']['document_number'];
         $sheetData['DocumentAmendmentRecordSheet']['issue_number'] = $data['MasterListOfFormat']['issue_number'];
         $sheetData['DocumentAmendmentRecordSheet']['revision_number'] = $data['MasterListOfFormat']['revision_number'];
         $sheetData['DocumentAmendmentRecordSheet']['revision_date'] = $data['MasterListOfFormat']['revision_date'];
         $sheetData['DocumentAmendmentRecordSheet']['document_details'] = $data['ChangeAdditionDeletionRequest']['current_document_details'];
         $sheetData['DocumentAmendmentRecordSheet']['work_instructions'] = $data['MasterListOfFormat']['work_instructions'];
         $sheetData['DocumentAmendmentRecordSheet']['prepared_by'] = $data['MasterListOfFormat']['prepared_by'];
         $sheetData['DocumentAmendmentRecordSheet']['approved_by'] = $data['MasterListOfFormat']['approved_by'];
         $sheetData['DocumentAmendmentRecordSheet']['amendment_details'] = $data['ChangeAdditionDeletionRequest']['proposed_changes'];
         $sheetData['DocumentAmendmentRecordSheet']['reason_for_change'] = $data['ChangeAdditionDeletionRequest']['reason_for_change'];
         $sheetData['DocumentAmendmentRecordSheet']['change_addition_deletion_request_id'] = $cad_id;
         $sheetData['DocumentAmendmentRecordSheet']['publish'] = 1;
         $sheetData['DocumentAmendmentRecordSheet']['soft_delete'] = 0;
         $sheetData['DocumentAmendmentRecordSheet']['created_by'] = $this->Session->read('User.id');
         $sheetData['DocumentAmendmentRecordSheet']['modified_by'] = $this->Session->read('User.id');
         $sheetData['DocumentAmendmentRecordSheet']['system_table_id'] = $this->_get_system_table_id('document_amendment_record_sheets');
         if ($this->DocumentAmendmentRecordSheet->save($sheetData['DocumentAmendmentRecordSheet'], false)) {
             // also update prepared by & approved by in MasterListOfFormatDepartment & branches
             $this->loadModel('MasterListOfFormatDepartment');
             $department_record = $this->MasterListOfFormatDepartment->find('first', array('fields' => array('MasterListOfFormatDepartment.id', 'MasterListOfFormatDepartment.master_list_of_format_id', 'MasterListOfFormatDepartment.company_id'), 'conditions' => array('MasterListOfFormatDepartment.master_list_of_format_id' => $data['MasterListOfFormat']['id'], 'MasterListOfFormatDepartment.company_id' => $this->Session->read('User.company_id'))));
             $this->MasterListOfFormatDepartment->read(null, $department_record['MasterListOfFormatDepartment']['id']);
             $this->MasterListOfFormatDepartment->set(array('prepared_by' => $data['ChangeAdditionDeletionRequest']['prepared_by'], 'approved_by' => $data['ChangeAdditionDeletionRequest']['approved_by']));
             $this->MasterListOfFormatDepartment->save();
             $this->loadModel('MasterListOfFormat');
             $this->MasterListOfFormat->read(null, $data['MasterListOfFormat']['id']);
             $this->MasterListOfFormat->set(array('prepared_by' => $data['ChangeAdditionDeletionRequest']['prepared_by'], 'approved_by' => $data['ChangeAdditionDeletionRequest']['approved_by']));
             $this->MasterListOfFormat->save();
             $newRecordId = $this->DocumentAmendmentRecordSheet->id;
             // get the master list of format id
             // goto folder and shift existing document to new document amendment id
             // as user to add updated document to previous id
             $copyTo = new Folder(WWW_ROOT . DS . 'files' . DS . $this->Session->read('User.company_id') . DS . 'Upload' . DS . $this->Session->read('User.id') . DS . 'document_amendment_record_sheets' . DS . $newRecordId . DS, true, 0777);
             foreach ($this->_get_user_list() as $key => $value) {
                 $copyFrom = new Folder(WWW_ROOT . 'files' . DS . $this->Session->read('User.company_id') . DS . 'Upload' . DS . $key . DS . 'master_list_of_formats' . DS . $data['ChangeAdditionDeletionRequest']['master_list_of_format'] . DS);
                 $copyFrom->copy(array('to' => $copyTo->path, 'mode' => 0777, 'skip' => '.DS_Store', 'scheme' => Folder::SKIP));
                 $copyFrom->delete();
                 // We also need to amend the FileUpload records for version controlling.
                 $this->_updateVers($data['MasterListOfFormat']['system_table_id'], $data['MasterListOfFormat']['id'], $newRecordId);
             }
         }
     }
 }
Пример #26
0
 /**
  * Copy a file, or recursively copy a folder and its contents
  *
  * @param string $dir Source path
  * @param string $to Destination path
  */
 static function copy($dir, $to)
 {
     // It's easier to handle this with the Folder class
     $object = new Folder($dir);
     return $object->copy($to);
 }
Пример #27
0
 /**
  * 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(sprintf(__("What is the path to the directory layout you wish to copy?\nExample: %s"), APP, null, ROOT . DS . 'myapp' . DS));
         if ($skel == '') {
             $this->out(__('The directory path you supplied was empty. Please try again.', true));
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in(__('Directory path does not exist please choose another:', true));
             }
         }
     }
     $app = basename($path);
     $this->out(__('Bake Project', true));
     $this->out(__("Skel Directory: ", true) . $skel);
     $this->out(__("Will be copied to: ", true) . $path);
     $this->hr();
     $looksGood = $this->in(__('Look okay?', true), array('y', 'n', 'q'), 'y');
     if (strtolower($looksGood) == 'y') {
         $verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
         $Folder = new Folder($skel);
         if (!empty($this->params['empty'])) {
             $skip = array();
         }
         if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
             $this->hr();
             $this->out(sprintf(__("Created: %s in %s", true), $app, $path));
             $this->hr();
         } else {
             $this->err(sprintf(__(" '%s' could not be created properly", true), $app));
             return false;
         }
         if (strtolower($verbose) == 'y') {
             foreach ($Folder->messages() as $message) {
                 $this->out($message);
             }
         }
         return true;
     } elseif (strtolower($looksGood) == 'q') {
         $this->out(__('Bake Aborted.', true));
     } else {
         $this->execute(false);
         return false;
     }
 }
Пример #28
0
 /**
  * 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
  * @access private
  */
 function __buildDirLayout($path)
 {
     $skel = $this->params['skel'];
     while ($skel == '') {
         $skel = $this->in("What is the path to the app directory you wish to copy?\nExample: " . APP, null, ROOT . DS . 'myapp' . DS);
         if ($skel == '') {
             $this->out('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('Bake Project');
     $this->out("Skel Directory: {$skel}");
     $this->out("Will be copied to: {$path}");
     $this->hr();
     $looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
     if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
         $verboseOuptut = $this->in('Do you want verbose output?', array('y', 'n'), 'n');
         $verbose = false;
         if (low($verboseOuptut) == 'y' || low($verboseOuptut) == 'yes') {
             $verbose = true;
         }
         $Folder = new Folder($skel);
         if ($Folder->copy($path)) {
             $path = $Folder->slashTerm($path);
             $this->hr();
             $this->out(sprintf(__("Created: %s in %s", true), $app, $path));
             $this->hr();
             if ($this->createHome($path)) {
                 $this->out('Welcome page created');
             } else {
                 $this->out('The Welcome page was NOT created');
             }
             if ($this->securitySalt($path) === true) {
                 $this->out('Random hash key created for \'Security.salt\'');
             } else {
                 $this->err('Unable to generate random hash for \'Security.salt\', please change this yourself in ' . CONFIGS . 'core.php');
             }
             $corePath = $this->corePath($path);
             if ($corePath === true) {
                 $this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH);
             } elseif ($corePath === false) {
                 $this->err('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . $path . 'webroot' . DS . 'index.php');
             }
             if (!$Folder->chmod($path . 'tmp', 0777)) {
                 $this->err('Could not set permissions on ' . $path . DS . 'tmp');
                 $this->out('You must manually check that these directories can be wrote to by the server');
             }
         } else {
             $this->err(" '" . $app . "' could not be created properly");
         }
         if ($verbose) {
             foreach ($Folder->messages() as $message) {
                 $this->out($message);
             }
         }
         return;
     } elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
         $this->out('Bake Aborted.');
     } else {
         $this->params['working'] = null;
         $this->params['app'] = null;
         $this->execute(false);
     }
 }
Пример #29
0
 /**
  * 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 mixed
  */
 public function bake($path, $skel = null, $skip = array('empty'))
 {
     if (!$skel && !empty($this->params['skel'])) {
         $skel = $this->params['skel'];
     }
     while (!$skel) {
         $skel = $this->in(__d('cake_console', "What is the path to the directory layout you wish to copy?"), null, CAKE . 'Console' . DS . 'Templates' . DS . 'skel');
         if (!$skel) {
             $this->err(__d('cake_console', 'The directory path you supplied was empty. Please try again.'));
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in(__d('cake_console', 'Directory path does not exist please choose another:'), null, CAKE . 'Console' . DS . 'Templates' . DS . 'skel');
             }
         }
     }
     $app = basename($path);
     $this->out(__d('cake_console', '<info>Skel Directory</info>: ') . $skel);
     $this->out(__d('cake_console', '<info>Will be copied to</info>: ') . $path);
     $this->hr();
     $looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n', 'q'), 'y');
     switch (strtolower($looksGood)) {
         case 'y':
             $Folder = new Folder($skel);
             if (!empty($this->params['empty'])) {
                 $skip = array();
             }
             if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
                 $this->hr();
                 $this->out(__d('cake_console', '<success>Created:</success> %s in %s', $app, $path));
                 $this->hr();
             } else {
                 $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;
         case 'n':
             unset($this->args[0]);
             $this->execute();
             return false;
         case 'q':
             $this->out(__d('cake_console', '<error>Bake Aborted.</error>'));
             return false;
     }
 }
Пример #30
0
 /**
  * 模块安装
  *
  * @param string $application
  */
 public function install($application = '')
 {
     defined('INSTALL') or define('INSTALL', true);
     if ($application) {
         $this->application = $application;
     }
     $this->installdir = APPS_PATH . $this->application . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR;
     $this->check();
     $models = @(require $this->installdir . 'model.php');
     if (!is_array($models) || empty($models)) {
         $models = array('application');
     }
     if (!in_array('application', $models)) {
         array_unshift($models, 'application');
     }
     if (is_array($models) && !empty($models)) {
         foreach ($models as $m) {
             $sql = file_get_contents($this->installdir . $m . '.sql');
             $this->sql_execute($sql);
             $this->m_db = Loader::model($m . '_model');
         }
     }
     if (file_exists($this->installdir . 'extention.inc.php')) {
         $admin_menu_db = Loader::model('admin_menu_model');
         @(include $this->installdir . 'extention.inc.php');
         if (!defined('INSTALL_APPLICATION')) {
             $file = WEKIT_PATH . 'languages' . DIRECTORY_SEPARATOR . C('config', 'lang') . DIRECTORY_SEPARATOR . 'admin_menu.php';
             if (file_exists($file)) {
                 $content = file_get_contents($file);
                 $content = substr($content, 0, -2);
                 $data = '';
                 foreach ($language as $key => $l) {
                     if (L($key, '', 'admin_menu') == L('NO_LANG') . '[' . $key . ']') {
                         $data .= "\$LANG['" . $key . "'] = '" . $l . "';\r\n";
                     }
                 }
                 $data = $content . $data . "?>";
                 file_put_contents($file, $data);
             } else {
                 foreach ($language as $key => $l) {
                     if (L($key, '', 'admin_menu') == L('NO_LANG') . '[' . $key . ']') {
                         $data .= "\$LANG['" . $key . "'] = '" . $l . "';\r\n";
                     }
                 }
                 $data = "<?" . "php\r\n\$data?>";
                 file_put_contents($file, $data);
             }
         }
     }
     if (!defined('INSTALL_APPLICATION')) {
         if (file_exists($this->installdir . 'languages' . DIRECTORY_SEPARATOR)) {
             Folder::copy($this->installdir . 'languages' . DIRECTORY_SEPARATOR, WEKIT_PATH . 'languages' . DIRECTORY_SEPARATOR);
         }
         if (file_exists($this->installdir . 'template' . DIRECTORY_SEPARATOR)) {
             Folder::copy($this->installdir . 'template' . DIRECTORY_SEPARATOR, WEKIT_PATH . 'template' . DIRECTORY_SEPARATOR . C('template', 'name') . DIRECTORY_SEPARATOR . $this->application . DIRECTORY_SEPARATOR);
             if (file_exists($this->installdir . 'template' . DIRECTORY_SEPARATOR . 'name.inc.php')) {
                 $keyid = 'template|' . C('template', 'name') . '|' . $this->application;
                 $file_explan[$keyid] = (include $this->installdir . 'templates' . DIRECTORY_SEPARATOR . 'name.inc.php');
                 $viewpath = WEKIT_PATH . 'template' . DIRECTORY_SEPARATOR . C('template', 'name') . DIRECTORY_SEPARATOR;
                 if (file_exists($viewpath . 'config.php')) {
                     $style_info = (include $viewpath . 'config.php');
                     $style_info['file_explan'] = array_merge($style_info['file_explan'], $file_explan);
                     @file_put_contents($viewpath . 'config.php', '<?php return ' . var_export($style_info, true) . ';?>');
                 }
                 unlink(WEKIT_PATH . 'template' . DIRECTORY_SEPARATOR . C('template', 'name') . DIRECTORY_SEPARATOR . $this->application . DIRECTORY_SEPARATOR . 'name.inc.php');
             }
         }
     }
     return true;
 }