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


PHP Filesystem::move方法代码示例

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


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

示例1: saveApk

 public function saveApk($file, $label, $name, $icon)
 {
     $fileSystem = new Filesystem();
     $parser = new ApkParser\Parser($file->getRealPath());
     $version = $parser->getManifest()->getVersionCode();
     $bundle = $parser->getManifest()->getPackageName();
     if (!$fileSystem->exists(public_path() . '/builds')) {
         $fileSystem->makeDirectory(public_path() . '/builds');
     }
     if (!$fileSystem->exists(public_path() . '/builds/android')) {
         $fileSystem->makeDirectory(public_path() . '/builds/android');
     }
     if (!$fileSystem->exists(public_path() . '/builds/android/' . $label)) {
         $fileSystem->makeDirectory(public_path() . '/builds/android/' . $label);
     }
     if (!$fileSystem->exists(public_path() . '/builds/android/' . $label . '/' . $version)) {
         $fileSystem->makeDirectory(public_path() . '/builds/android/' . $label . '/' . $version);
     }
     $label_model = Label::where('label_name', '=', $label)->where('build_type_id', '=', self::BUILD_ANDROID_TYPE_ID)->first();
     if ($label_model != null) {
         $version_model = $label_model->versions()->where('version', '=', $version)->first();
         if ($version_model != null) {
             $build_version_count = Build::where('version_id', '=', $version_model->id)->count();
             $build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => $build_version_count + 1));
         } else {
             $version_model = Version::create(array('version' => $version, 'label_id' => $label_model->id));
             $build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => 1));
         }
     } else {
         $label_model = Label::create(array('label_name' => $label, 'build_type_id' => self::BUILD_ANDROID_TYPE_ID));
         $version_model = Version::create(array('version' => $version, 'label_id' => $label_model->id));
         $build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => 1));
     }
     $fn = public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build . '/' . $bundle . '.apk';
     if (!$fileSystem->exists(public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build)) {
         $fileSystem->makeDirectory(public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build);
     }
     $fileSystem->move($file->getRealPath(), $fn);
     $fileSystem->move($icon->getRealPath(), public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build . '/' . $bundle . '.png');
     return Config::get("app.domain") . "/android/builds/{$label}/{$version}/{$build->build}";
 }
开发者ID:NeZanyat,项目名称:laravel-example,代码行数:41,代码来源:BuildController.php

示例2: save

 /**
  * @return bool
  * @throws Exception
  */
 public function save()
 {
     if ($this->isReadOnly() and !$this->isNew()) {
         return false;
     }
     $status = true;
     if ($this->isNew()) {
         $newFilename = normalize_path($this->basePath . DIRECTORY_SEPARATOR . $this->changed['name']);
         $status = touch($newFilename) !== false;
         if ($status) {
             chmod($newFilename, 0777);
             $this->file = new SplFileObject($newFilename);
         }
     } elseif ($this->isChanged('name')) {
         $newFilename = normalize_path($this->getPath() . '/' . $this->changed['name']);
         if ($newFilename != $this->getRealPath()) {
             $status = @$this->filesSystem->move($this->getRealPath(), $newFilename);
         }
         if ($status) {
             $this->file = new SplFileObject($newFilename);
         }
     }
     if ($status and $this->isChanged('content')) {
         $status = $this->filesSystem->put($this->getRealPath(), $this->changed['content']) !== false;
     }
     $this->changed = [];
     return $status;
 }
开发者ID:KodiComponents,项目名称:module-core,代码行数:32,代码来源:File.php

示例3: logInfo

 /**
  * write log
  * @param  string $logContent [logContent]
  * @param  string $logDirPath [filepath]
  */
 public function logInfo($logContent, $logDirPath)
 {
     $filesystem = new Filesystem();
     if (!$logContent || !$logDirPath) {
         return false;
     }
     if ($this->getMailLog()) {
         // log file all path
         $logPath = $logDirPath . $this->getLogName();
         if ($filesystem->exists($logPath)) {
             // everyDay new a file
             $content = $filesystem->get($logPath);
             if ($logTime = substr($content, 1, 10)) {
                 if (Carbon::now($this->local)->toDateString() == $logTime) {
                     $filesystem->append($logPath, $logContent . PHP_EOL);
                 } else {
                     $new_log_path = $logDirPath . $logTime . $this->getLogName();
                     if (!$filesystem->exists($new_log_path)) {
                         $filesystem->move($logPath, $new_log_path);
                     }
                     $filesystem->put($logPath, $logContent);
                 }
             }
         } else {
             $filesystem->put($logPath, $logContent);
         }
     }
 }
开发者ID:mrvokia,项目名称:mailhub,代码行数:33,代码来源:MailHubLogTrait.php

示例4: renameModelsAndRepositories

 /**
  * Rename models and repositories.
  */
 public function renameModelsAndRepositories()
 {
     $moduleDir = base_path('Modules/' . $this->module);
     $paths = [$moduleDir . '/Models/Object.php', $moduleDir . '/Models/ObjectTranslation.php', $moduleDir . '/Repositories/ObjectInterface.php', $moduleDir . '/Repositories/EloquentObject.php'];
     foreach ($paths as $path) {
         $this->files->move($path, $this->transformFilename($path));
     }
 }
开发者ID:eahrold,项目名称:Core,代码行数:11,代码来源:Create.php

示例5: moveAssets

 protected function moveAssets()
 {
     // 移動 css 檔
     $this->filesystem->move(base_path('resources/views/css/ccu.css.php'), cdn_path('css/ccu.min.css'));
     // 移動 js 檔
     $this->filesystem->move(temp_path('vendors.min.js'), cdn_path('js/vendors.min.js'));
     $this->info('Move assets successfully!');
 }
开发者ID:BePsvPT,项目名称:CCU,代码行数:8,代码来源:ProductionRelease.php

示例6: fire

 /**
  * Create date folder structure and move migrations into.
  *
  * @return void
  */
 public function fire()
 {
     $this->basePath = $this->getMigrationPath();
     $migrations = $this->migrator->getMigrationFiles($this->basePath);
     $count = count($migrations);
     if ($count == 0) {
         $this->comment('No migrations to move');
         return;
     }
     foreach ($migrations as $migration) {
         $datePath = $this->migrator->getDateFolderStructure($migration);
         // Move the migration into base migration folder
         $this->files->move($this->basePath . '/' . $datePath . $migration . '.php', $this->basePath . '/' . $migration . '.php');
     }
     $this->info('Migrations disorganised successfully (' . $count . ' migrations moved)');
     $this->cleanup();
 }
开发者ID:jaybizzle,项目名称:laravel-migrations-organiser,代码行数:22,代码来源:MigrateDisorganise.php

示例7: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $defaultEnvironmentFile = 'bootstrap/environment.local.php';
     $environmentFile = 'bootstrap/environment.php';
     $this->line('Welcome to TypiCMS');
     if (!$this->files->exists($environmentFile) && $this->files->exists($defaultEnvironmentFile)) {
         // move default environment file so current environment will be local.
         $this->files->move($defaultEnvironmentFile, $environmentFile);
         // set environment to local
         $this->laravel['env'] = 'local';
         $this->line('----------------------');
         $this->info('Environment set to local');
         $this->line('----------------------');
     }
     $this->checkThatEnvTemplateExists();
     // Ask for database name
     $dbName = $this->ask('What is your database name? ');
     // Set database credentials in env.local.php and migrate
     $this->call('typicms:database', array('database' => $dbName));
     $this->line('----------------------');
     // Set cache key prefix
     $this->call('cache:prefix', array('prefix' => $dbName));
     $this->line('----------------------');
     // Composer install
     if (function_exists('system')) {
         $this->info('Running npm install...');
         system('npm install');
         $this->info('npm packages installed');
         $this->line('----------------------');
         $this->info('Running bower install...');
         system('bower install');
         $this->info('Bower packages installed');
         $this->line('----------------------');
         system('chmod -R 777 app/storage');
         $this->info('app/storage is now writable');
         system('chmod -R 777 public/uploads');
         $this->info('public/uploads is now writable');
     } else {
         $this->line('You can now make app/storage and public/uploads writable');
         $this->line('and run composer install, npm install and bower install.');
     }
     // Done
     $this->line('----------------------');
     $this->line('Done. Enjoy TypiCMS!');
 }
开发者ID:mrkodssldrf,项目名称:TypiCMS,代码行数:50,代码来源:Install.php

示例8: backup

 protected function backup($file)
 {
     $backupPath = $this->app->make('path.storage') . '/packages/backup/' . $this->package->getName();
     if (!$this->filesystem->isDirectory($backupPath)) {
         $this->filesystem->makeDirectory($backupPath, 0755, true);
     }
     $newFile = $backupPath . '/' . date('Ymdhis') . '_' . basename($file);
     $this->filesystem->move($file, $newFile);
 }
开发者ID:mvalim,项目名称:package-utils,代码行数:9,代码来源:Publisher.php

示例9: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle(ValidateFilenameService $validateFilename, Filesystem $filesystem)
 {
     $files = [];
     foreach ($this->files as $file) {
         $filename = $validateFilename->execute($this->targetDir, $file);
         $filesystem->move($this->originDir . '/' . $file, $this->targetDir . '/' . $filename);
         $files[] = $filename;
     }
     return $files;
 }
开发者ID:ngangchill,项目名称:LaravelSteroids,代码行数:15,代码来源:MoveBulkFilesJob.php

示例10: fire

 /**
  * Create date folder structure and move migrations into.
  *
  * @return void
  */
 public function fire()
 {
     $basePath = $this->getMigrationPath();
     $migrations = $this->migrator->getMigrationFiles($basePath, false);
     $count = count($migrations);
     if ($count == 0) {
         $this->comment('No migrations to move');
         return;
     }
     foreach ($migrations as $migration) {
         $datePath = $this->migrator->getDateFolderStructure($migration);
         // Create folder if it does not already exist
         if (!$this->files->exists($basePath . '/' . $datePath)) {
             $this->files->makeDirectory($basePath . '/' . $datePath, 0775, true);
         }
         // Move the migration into its new folder
         $this->files->move($basePath . '/' . $migration . '.php', $basePath . '/' . $datePath . $migration . '.php');
     }
     $this->info('Migrations organised successfully (' . $count . ' migrations moved)');
 }
开发者ID:jwcastillo,项目名称:Laravel-Migrations-Organiser,代码行数:25,代码来源:MigrateOrganise.php

示例11: move

 /**
  * Function to move files / folders given in the template
  * configuration from the given source to the
  * given destination.  
  * 
  * @return void
  */
 public function move()
 {
     $key = str_replace(TemplateReader::STRUCTURE . '.', '', TemplateReader::STRUCTURE_MOVE);
     $data = array_get($this->config, $key);
     foreach ($data as $mv) {
         if (!empty($mv['from']) && !empty($mv['to'])) {
             $from = Path::absolute($mv['from'], $this->appDir);
             $to = Path::absolute($mv['to'], $this->appDir);
             $this->command->comment("Move", "from {$from} to {$to}");
             $this->filesystem->move($from, $to);
         }
     }
 }
开发者ID:dhaval48,项目名称:foreman,代码行数:20,代码来源:Structure.php

示例12: handle

 /**
  * @param Filesystem $files
  * @param AccountManager $manager
  * @return mixed
  */
 public function handle(Filesystem $files, AccountManager $manager)
 {
     $temp_dir = storage_path('media') . '/' . $this->owner->getMediaFolder('images');
     $name = $this->uniqueName();
     $this->image->move($temp_dir, $name);
     $temp_file = $temp_dir . $name;
     $name_with_extension = $name . $this->extension($temp_file);
     $final_path = $temp_file . $name_with_extension;
     $files->move($temp_file, $final_path);
     $image = $this->dispatch(new StoreNewImage($manager->account(), $this->owner, $final_path));
     $files->delete($final_path);
     return $image;
 }
开发者ID:jaffle-be,项目名称:framework,代码行数:18,代码来源:UploadNewImage.php

示例13: store

 public function store()
 {
     $filesystem = new Filesystem();
     $advertising = Advertising::where('name', '=', Input::get('name'));
     if (!$advertising->count() > 0) {
         $advertising = Advertising::create(['name' => Input::get('name'), 'bio' => Input::get('bio')]);
     }
     if (Input::has('image')) {
         $destination = public_path() . "/images/advertising/";
         $filename = Input::file('image');
         $file = $filesystem->move($destination, $filename);
         if ($file) {
             $advertising->image = $filename;
         }
         $advertising->save();
     }
     if ($advertising) {
         return Redirect::to('admin/advertising/' . $advertising->id . '/show', ['advertising' => $advertising, 'add_failed' => 'false']);
     }
     return View::make('admin.advertising.add', ['add_failed' => 'true']);
     /*
             if (\Input::get('name')) {
                 $filesystem = new Filesystem;
                 $advertising = \Advertising::findOrCreate(\Input::get('name'));
                 //$advertising_exists = \Advertising::where('name', '=', \Input::get('name'));
                     if ($exists->id) {
                         return \View::make('admin.advertising.add', ['add_failed'=> 'true', 'error_msg' => 'An entry for this advertising already exists!']);
                     }
                     //$new_advertising = \Advertising::create(\Input::only(['name', 'image', 'bio']));
                     $advertising->name = \Input::get('name');
                     $advertising->bio = \Input::get('bio');
     
                     if (\Input::has('image')) {
                         $destination = public_path() . "/images/advertising/";
                         $filename = \Input::file('image');
                         $upload_success = $filesystem->move($destination, $filename);
                         //$upload_success = \Input::file('image')->move($destinationPath, $filename);
                         if ($upload_success) {
                                $advertising->image = $filename;
                         }
                     }
                     $advertising->save();
                     return \View::make('admin.advertising.add', ['add_failed' => 'true']);
     
             }*/
 }
开发者ID:skinuxgeek,项目名称:NewsWise,代码行数:46,代码来源:ServicesController.php

示例14: handle

 /**
  * @param Gravatar $gravatar
  * @param Filesystem $files
  * @param AccountManager $manager
  * @throws \Exception
  */
 public function handle(Gravatar $gravatar, Filesystem $files, AccountManager $manager)
 {
     if ($gravatar->exists($this->user->email)) {
         $gravatar->setAvatarSize(512);
         $url = $gravatar->get($this->user->email);
         $content = file_get_contents($url);
         $tmpDir = storage_path('media' . '/' . $this->user->getMediaFolder());
         if (!$files->isDirectory($tmpDir)) {
             $files->makeDirectory($tmpDir, 0755, true);
         }
         $path = $tmpDir . sha1(time() . 'user-profile-pic' . $this->user->id);
         $files->put($path, $content);
         $finalPath = $this->pathWithExtension($path);
         $files->move($path, $finalPath);
         $this->dispatch(new StoreNewImage($manager->account(), $this->user, $finalPath));
         $files->delete($finalPath);
     }
 }
开发者ID:jaffle-be,项目名称:framework,代码行数:24,代码来源:CheckGravatarImage.php

示例15: backup

 /**
  * 将非必要文件转移至备份文件夹,以减小 vendor 目录体积
  * @return void
  */
 public static function backup()
 {
     $Filesystem = new Filesystem();
     $vendorDir = dirname(dirname(dirname(dirname(__DIR__))));
     $topDir = dirname($vendorDir);
     $backupDir = $topDir . '/VendorCleanerBackup';
     // 获取主要规则文件
     // 若 vendor 同级目录下存在用户自定义文件,则使用用户自定义文件
     if ($Filesystem->exists($topDir . '/VendorCleaner.config.php')) {
         $rules = (require $topDir . '/VendorCleaner.config.php');
     } else {
         $rules = (require 'VendorCleaner/VendorCleaner.config.php');
     }
     // 分别处理各个资源包
     foreach ($rules as $packageDir => $rule) {
         if (!file_exists($vendorDir . '/' . $packageDir)) {
             continue;
         }
         // 拆分子规则
         $patterns = explode(' ', $rule);
         // 执行拆分后的规则
         foreach ($patterns as $pattern) {
             $Finder = new Finder();
             try {
                 foreach ($Finder->name($pattern)->in($vendorDir . '/' . $packageDir) as $file) {
                     $backup = str_replace($vendorDir, $backupDir, $file);
                     if ($file->isDir()) {
                         // 文件夹处理
                         $Filesystem->copyDirectory($file, $backup);
                         $Filesystem->deleteDirectory($file);
                     } elseif ($file->isFile()) {
                         // 文件处理
                         $Filesystem->move($file, $backup);
                     }
                 }
             } catch (\Exception $e) {
             }
         }
     }
 }
开发者ID:baitongda,项目名称:VendorCleaner,代码行数:44,代码来源:VendorCleaner.php


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