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


PHP Folder::errors方法代码示例

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


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

示例1: testDelete

 /**
  * testDelete method
  *
  * @return void
  */
 public function testDelete()
 {
     $path = TMP . 'tests' . DS . 'folder_delete_test';
     mkdir($path, 0777, true);
     touch($path . DS . 'file_1');
     mkdir($path . DS . 'level_1_1');
     touch($path . DS . 'level_1_1/file_1_1');
     mkdir($path . DS . 'level_1_1/level_2_1');
     touch($path . DS . 'level_1_1/level_2_1/file_2_1');
     touch($path . DS . 'level_1_1/level_2_1/file_2_2');
     mkdir($path . DS . 'level_1_1/level_2_2');
     $Folder = new Folder($path, true);
     $return = $Folder->delete();
     $this->assertTrue($return);
     $messages = $Folder->messages();
     $errors = $Folder->errors();
     $this->assertEquals([], $errors);
     $expected = [$path . DS . 'file_1 removed', $path . DS . 'level_1_1' . DS . 'file_1_1 removed', $path . DS . 'level_1_1' . DS . 'level_2_1' . DS . 'file_2_1 removed', $path . DS . 'level_1_1' . DS . 'level_2_1' . DS . 'file_2_2 removed', $path . DS . 'level_1_1' . DS . 'level_2_1 removed', $path . DS . 'level_1_1' . DS . 'level_2_2 removed', $path . DS . 'level_1_1 removed', $path . ' removed'];
     sort($expected);
     sort($messages);
     $this->assertEquals($expected, $messages);
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:27,代码来源:FolderTest.php

示例2: sync

 public function sync($id = null)
 {
     $folder = new Folder();
     $folders_to_copy = ['f1' => ['dev' => '../src', 'prod' => '../../production/src'], 'f2' => ['dev' => '../plugins', 'prod' => '../../production/plugins'], 'f3' => ['dev' => '../webroot', 'prod' => '../../production/webroot'], 'f4' => ['dev' => '../config', 'prod' => '../../production/config']];
     $pass = 0;
     $fail = 0;
     foreach ($folders_to_copy as $ftc) {
         $p = new Folder($ftc['prod']);
         $d = new Folder($ftc['dev']);
         if ($folder->copy(['to' => $p->pwd(), 'from' => $d->pwd(), 'scheme' => Folder::MERGE])) {
             $pass++;
         } else {
             $fail++;
         }
     }
     if ($fail == 0) {
         $this->Flash->success(__('Production updated successfully.'));
     } else {
         $errors = '';
         foreach ($folder->errors() as $error) {
             $errors .= ' : ' . $error;
         }
         $this->Flash->error(__('Unable to update {0} folders on production. Errors' . $errors, $fail));
     }
     return $this->redirect($this->referer());
 }
开发者ID:jaambageek,项目名称:cakeboot-template,代码行数:26,代码来源:FilesController.php

示例3: bake

 /**
  * Bake the plugin, create directories and files
  *
  * @param string $plugin Name of the plugin in CamelCased format
  * @return bool
  */
 public function bake($plugin)
 {
     $pathOptions = App::path('Plugin');
     if (count($pathOptions) > 1) {
         $this->findPath($pathOptions);
     }
     $this->hr();
     $this->out(sprintf("<info>Plugin Name:</info> %s", $plugin));
     $this->out(sprintf("<info>Plugin Directory:</info> %s", $this->path . $plugin));
     $this->hr();
     $classBase = 'src';
     $looksGood = $this->in('Look okay?', ['y', 'n', 'q'], 'y');
     if (strtolower($looksGood) === 'y') {
         $Folder = new Folder($this->path . $plugin);
         $directories = ['config', $classBase . DS . 'Model' . DS . 'Behavior', $classBase . DS . 'Model' . DS . 'Table', $classBase . DS . 'Model' . DS . 'Entity', $classBase . DS . 'Shell' . DS . 'Task', $classBase . DS . 'Controller' . DS . 'Component', $classBase . DS . 'View' . DS . 'Helper', $classBase . DS . 'Template', 'tests' . DS . 'TestCase' . DS . 'Controller' . DS . 'Component', 'tests' . DS . 'TestCase' . DS . 'View' . DS . 'Helper', 'tests' . DS . 'TestCase' . DS . 'Model' . DS . 'Behavior', 'tests' . DS . 'Fixture', 'webroot'];
         foreach ($directories as $directory) {
             $dirPath = $this->path . $plugin . DS . $directory;
             $Folder->create($dirPath);
             new File($dirPath . DS . 'empty', true);
         }
         foreach ($Folder->messages() as $message) {
             $this->out($message, 1, Shell::VERBOSE);
         }
         $errors = $Folder->errors();
         if (!empty($errors)) {
             foreach ($errors as $message) {
                 $this->error($message);
             }
             return false;
         }
         $controllerFileName = 'AppController.php';
         $out = "<?php\n\n";
         $out .= "namespace {$plugin}\\Controller;\n\n";
         $out .= "use App\\Controller\\AppController as BaseController;\n\n";
         $out .= "class AppController extends BaseController {\n\n";
         $out .= "}\n";
         $this->createFile($this->path . $plugin . DS . $classBase . DS . 'Controller' . DS . $controllerFileName, $out);
         $emptyFile = $this->path . 'empty';
         $this->_deleteEmptyFile($emptyFile);
         $hasAutoloader = $this->_modifyAutoloader($plugin, $this->path);
         $this->_generateRoutes($plugin, $this->path);
         $this->_modifyBootstrap($plugin, $hasAutoloader);
         $this->_generatePhpunitXml($plugin, $this->path);
         $this->_generateTestBootstrap($plugin, $this->path);
         $this->hr();
         $this->out(sprintf('<success>Created:</success> %s in %s', $plugin, $this->path . $plugin), 2);
     }
     return true;
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:55,代码来源:PluginTask.php


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