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


PHP Filesystem::isWritable方法代码示例

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


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

示例1: setPath

 /**
  * Set the path for the JSON file.
  *
  * @param  string  $path
  *
  * @return self
  */
 public function setPath($path)
 {
     if (!$this->files->exists($path) && $this->files->put($path, '{}') === false) {
         throw new InvalidArgumentException("Could not write to {$path}.");
     }
     if (!$this->files->isWritable($path)) {
         throw new InvalidArgumentException("{$path} is not writable.");
     }
     $this->path = $path;
     return $this;
 }
开发者ID:ARCANEDEV,项目名称:Settings,代码行数:18,代码来源:JsonStore.php

示例2: make

 /**
  * Compile routes template and generate
  *
  * @param string $path
  * @param string $name
  * @param array $options
  * @return boolean
  */
 public function make($path, $name, array $options = [])
 {
     $options += ['filter' => null, 'prefix' => null];
     $this->parsedRoutes = $this->getParsedRoutes($options['filter'], $options['prefix']);
     $template = $this->file->get(__DIR__ . '/templates/Router.js');
     $template = str_replace("routes: null,", 'routes: ' . json_encode($this->parsedRoutes) . ',', $template);
     $template = str_replace("'Router'", "'" . $options['object'] . "'", $template);
     if ($this->file->isWritable($path)) {
         $filename = $path . '/' . $name;
         return $this->file->put($filename, $template) !== false;
     }
     return false;
 }
开发者ID:fedeisas,项目名称:laravel-js-routes,代码行数:21,代码来源:RoutesJavascriptGenerator.php

示例3: setPath

 /**
  * Set the path for the JSON file.
  *
  * @param string $path
  */
 public function setPath($path)
 {
     if (!$this->filesystem->exists($path)) {
         $result = $this->filesystem->put($path, '{}');
         if (!$result) {
             throw new \InvalidArgumentException("Could not write to {$path}.");
         }
     }
     if (!$this->filesystem->isWritable($path)) {
         throw new \InvalidArgumentException("{$path} is not writable.");
     }
     $this->path = $path;
 }
开发者ID:gocrew,项目名称:laravel-settings,代码行数:18,代码来源:Json.php

示例4: setPath

 /**
  * Set the path for the JSON file.
  *
  * @param string $path
  * @throws NotWritableException
  */
 public function setPath($path)
 {
     if (!$this->files->exists($path)) {
         $result = $this->files->put($path, '{}');
         if ($result === false) {
             throw new NotWritableException("Could not write to {$path}.");
         }
     }
     if (!$this->files->isWritable($path)) {
         throw new NotWritableException("{$path} is not writable.");
     }
     $this->path = $path;
 }
开发者ID:AlexanderPoellmann,项目名称:laravel-settings,代码行数:19,代码来源:FileDriver.php

示例5: undo

 /**
  * Perform undo action
  *
  * @return void
  */
 protected function undo()
 {
     // Delete status
     $deleteCompleted = true;
     // Get files from the json undo file
     $files = json_decode($this->filesystem->get($this->undoFilePath), true);
     // For each file
     $this->info('Deleting files:');
     foreach ($files as $file) {
         // If this file can be deleted
         if ($this->filesystem->isWritable($file)) {
             // Delete it
             $this->filesystem->delete($file);
             $this->info("  Deleted: {$file}");
         } else {
             // Set status
             $deleteCompleted = false;
             // Show error
             $this->error('Could not delete: ' . $file);
         }
     }
     // if the delete prccess finished successfully
     if ($deleteCompleted) {
         // Delete undo file
         $this->filesystem->delete($this->undoFilePath);
     }
 }
开发者ID:mojopollo,项目名称:laravel-json-schema,代码行数:32,代码来源:MakeMigrationJsonCommand.php

示例6: store

 /**
  * @param \Exolnet\Image\Imageable                    $image
  * @param \Symfony\Component\HttpFoundation\File\File $file
  * @return bool
  * @throws \Exolnet\Core\Exceptions\ServiceValidationException
  */
 public function store(Imageable $image, File $file)
 {
     if (!$image->getFilename()) {
         throw new ServiceValidationException('Could not store image with an empty filename.');
     }
     $path = dirname($image->getImagePath());
     $filename = basename($image->getImagePath());
     if (!$this->filesystem->exists($path)) {
         $this->filesystem->makeDirectory($path, 0755, true);
     }
     if (!$this->filesystem->isWritable($path)) {
         throw new ServiceValidationException('The image base path "' . $path . '" is not writable.');
     }
     $file->move($path, $filename);
     return true;
 }
开发者ID:eXolnet,项目名称:laravel-image,代码行数:22,代码来源:FilesystemRepository.php

示例7: handle

 /**
  * Handle the command.
  *
  * @param Filesystem  $files
  * @param Application $application
  */
 public function handle(Filesystem $files, Application $application)
 {
     $paths = ['storage', $application->getStoragePath(), 'public/assets', $application->getAssetsPath()];
     foreach ($paths as $path) {
         if ($files->exists(base_path($path)) && !$files->isWritable(base_path($path))) {
             die('chmod -R 777 ' . base_path($path));
         }
     }
 }
开发者ID:bloveless,项目名称:installer-module,代码行数:15,代码来源:CheckDirectoryPermissions.php

示例8: getStaticPathLocation

 /**
  * Where in the /public directory should the files
  * be stored?
  * 
  * @return string $path
  */
 public function getStaticPathLocation()
 {
     $path = public_path() . $this->fileLocation;
     if (!$this->fs->isWritable($path)) {
         throw new PathNotWritableException();
     }
     if (!$this->fs->isDirectory($path)) {
         $this->fs->makeDirectory($path);
     }
     return $path;
 }
开发者ID:phpcmsapp,项目名称:static-generator,代码行数:17,代码来源:Generator.php

示例9: createFile

 /**
  * Erstellt die module.json Datei
  * 
  * @param string $module
  * @return void
  */
 private function createFile($module)
 {
     $module = $this->modules[$module];
     if($this->files->isWritable($module))
     {
         $this->files->copy(__DIR__.'/../templates/module.json', $module.'/module.json');
     }
     else
     {
         return App::abort('403', "Please set writable permissions to " . $module . "\n");
     }
 }
开发者ID:nguyenchilong,项目名称:modulemanager,代码行数:18,代码来源:Modules.php

示例10: checkEnv

 protected function checkEnv($path, $name, $namespace, $title)
 {
     // check directory exists
     if ($this->files->exists($path)) {
         $this->error($this->type . ' already exists!');
         return false;
     }
     // check permission
     $pluginsDir = app('xe.plugin')->getPluginsDir();
     if (!$this->files->isWritable($pluginsDir)) {
         $this->error("Permission denied. Can not create plugin directory({$path}).");
         return false;
     }
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:14,代码来源:PluginMakeCommand.php

示例11: checkEnv

 protected function checkEnv($path, $name, $namespace, $title)
 {
     // check directory exists
     if ($this->files->exists($path)) {
         $this->error('Plugin already exists!');
         return false;
     }
     // check namespace
     if (!str_contains($namespace, '\\')) {
         $this->error('The namespace must have at least 1 delimiter(\\), use double backslash(\\\\) as delimiter');
         return false;
     }
     // check permission
     $pluginsDir = app('xe.plugin')->getPluginsDir();
     if (!$this->files->isWritable($pluginsDir)) {
         $this->error("Permission denied. Can not create plugin directory({$path}).");
         return false;
     }
 }
开发者ID:xpressengine,项目名称:xpressengine,代码行数:19,代码来源:PluginMake.php

示例12: isWritable

 /**
  * Determine if the given path is writable.
  *
  * @param string $path
  * @return bool 
  * @static 
  */
 public static function isWritable($path)
 {
     return \Illuminate\Filesystem\Filesystem::isWritable($path);
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php

示例13: ensureAttachmentFolder

 /**
  * Helper to ensure attachment folder
  */
 protected function ensureAttachmentFolder()
 {
     $file = new Filesystem();
     // Ensure base folder
     if (!$file->isDirectory($this->directory)) {
         $file->makeDirectory($this->directory, 0777, true);
     }
     // Ensure media folder
     if (!$file->isDirectory($this->media_directory)) {
         $file->makeDirectory($this->media_directory, 0777, true);
     }
     if (!$file->isWritable($this->directory) || !$file->isWritable($this->media_directory)) {
         throw new RuntimeException('Invalid attachment directory');
     }
 }
开发者ID:sgh1986915,项目名称:laravel-bizgym,代码行数:18,代码来源:AttachmentController.php


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