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


PHP Filesystem::copy方法代码示例

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


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

示例1: publishAddFunctionMigration

 /**
  * Copy migration files from the migrations directory
  *
  * @access public
  * @param string $targetPath
  * @return void
  */
 public function publishAddFunctionMigration($targetPath)
 {
     // The wgs84distance migration
     $source = __DIR__ . '/../../../' . self::MIGRATION_FUNCTION_NAME . '.php';
     $target = $this->getMigrationFileName(self::MIGRATION_FUNCTION_NAME);
     $this->doNotOverwriteFile($targetPath, self::MIGRATION_FUNCTION_NAME);
     $this->file->copy($source, "{$targetPath}/{$target}");
 }
开发者ID:ardyn,项目名称:zipcode,代码行数:15,代码来源:MigrationPublisher.php

示例2: publishFile

 /**
  * Publish the file to the given path.
  *
  * @param  string  $from
  * @param  string  $to
  * @return void
  */
 protected function publishFile($from, $to)
 {
     if ($this->files->exists($to) && !$this->option('force')) {
         return;
     }
     $this->createParentDirectory(dirname($to));
     $this->files->copy($from, $to);
     $this->status($from, $to, 'File');
 }
开发者ID:HarveyCheng,项目名称:myblog,代码行数:16,代码来源:VendorPublishCommand.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $files = new Filesystem();
     $files->copy(__DIR__ . '/stubs/scaffold/Http/Controllers/HomeController.php', app_path('Http/Controllers/HomeController.php'));
     $files->copyDirectory(__DIR__ . '/stubs/scaffold/Http/Controllers/Auth', app_path('Http/Controllers/Auth'));
     $files->copy(__DIR__ . '/stubs/scaffold/Http/routes.php', app_path('Http/routes.php'));
     $files->copy(__DIR__ . '/stubs/scaffold/Providers/AppServiceProvider.php', app_path('Providers/AppServiceProvider.php'));
     $files->copyDirectory(__DIR__ . '/stubs/scaffold/resources/views', base_path('resources/views'));
     $this->info('Authentication scaffolding complete!');
 }
开发者ID:mnshankar,项目名称:auth-scaffold,代码行数:15,代码来源:ScaffoldAuthCommand.php

示例4: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $destination = $this->laravel['path'] . '/controllers/RemindersController.php';
     if (!$this->files->exists($destination)) {
         $this->files->copy(__DIR__ . '/stubs/controller.stub', $destination);
         $this->info('Password reminders controller created successfully!');
         $this->comment("Route: Route::controller('password', 'RemindersController');");
     } else {
         $this->error('Password reminders controller already exists!');
     }
 }
开发者ID:dlpc,项目名称:O2OMobile_PHP,代码行数:16,代码来源:RemindersControllerCommand.php

示例5: setUp

 public function setUp()
 {
     $this->fileSystem = new Filesystem();
     $this->cache = new Repository(new FileStore($this->fileSystem, './cache'));
     $this->fileSystem->copy('./stubs.sqlite', './stubs-real.sqlite');
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'sqlite', 'database' => './stubs-real.sqlite', 'prefix' => '']);
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
     $this->connection = $capsule->getDatabaseManager()->connection('default');
 }
开发者ID:wandu,项目名称:laravel-repository,代码行数:11,代码来源:RepositoryTestCase.php

示例6: setUp

 /**
  *
  */
 public function setUp()
 {
     parent::setUp();
     $this->config = App::make('Illuminate\\Contracts\\Config\\Repository');
     $module = App::make('modules');
     $this->finder = App::make('Illuminate\\Filesystem\\Filesystem');
     $this->imagy = new Imagy(new InterventionFactory(), new ThumbnailsManager($this->config, $module), $this->config);
     $this->testbenchPublicPath = __DIR__ . '/../vendor/orchestra/testbench/fixture/public/';
     $this->mediaPath = __DIR__ . '/Fixtures/';
     $this->finder->copy("{$this->mediaPath}google-map.png", "{$this->testbenchPublicPath}google-map.png");
 }
开发者ID:swyong,项目名称:Media,代码行数:14,代码来源:ImagyTest.php

示例7: CreatePowerMigration

 public function CreatePowerMigration()
 {
     $des1 = $this->laravel->path . "/database/migrations/" . date('Y_m_d_His') . "_power_migration_table.php";
     $des2 = $this->laravel->path . "/database/migrations/" . date('Y_m_d_His') . "_power_soft_delete_table.php";
     $file1 = __DIR__ . '/../../../migrations/PowerMigrationTable.php';
     $file2 = __DIR__ . '/../../../migrations/PowerSoftDeleteTable.php';
     $f = new Filesystem();
     if ($f->copy($file1, $des1) && $f->copy($file2, $des2)) {
         return true;
     }
     return false;
 }
开发者ID:canaan5,项目名称:power,代码行数:12,代码来源:MigrationGeneratorCommand.php

示例8: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $name = $this->argument('name');
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles(base_path('resources/themes/' . strtolower($name) . '/public'));
     foreach ($files as $file) {
         if ($file->getType() === 'file') {
             $this->line(public_path($file->getBasename()));
         }
     }
     $this->info("\n\nThese files will be overwritten\n");
     if (!$this->option('forced')) {
         $result = $this->confirm('Are you sure you want to overwrite any files of the same name?');
     } else {
         $result = true;
     }
     if ($result) {
         foreach ($files as $file) {
             $newFileName = str_replace(base_path('resources/themes/' . strtolower($name) . '/public/'), '', $file);
             $this->line('Copying ' . public_path($newFileName) . '...');
             if (is_dir($file)) {
                 $fileSystem->copyDirectory($file, public_path($newFileName));
             } else {
                 @mkdir(public_path(str_replace(basename($newFileName), '', $newFileName)), 0755, true);
                 $fileSystem->copy($file, public_path($newFileName));
             }
         }
     } else {
         $this->info("\n\nNo files were published\n");
     }
 }
开发者ID:YABhq,项目名称:Quarx,代码行数:36,代码来源:ThemePublish.php

示例9: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(Filesystem $files)
 {
     $data = [];
     $newLocale = $this->input->getOption('locale');
     foreach (app('module.loader')->getRegisteredModules() as $module) {
         if (!is_dir($module->getLocalePath())) {
             continue;
         }
         foreach ($files->directories($module->getLocalePath()) as $localeDir) {
             $locale = basename($localeDir);
             if ($locale != $this->copiedLocale) {
                 continue;
             }
             foreach ($files->allFiles($localeDir) as $localeFile) {
                 $data[strtolower($module->getName())][] = $localeFile->getRealPath();
             }
         }
     }
     $langDirectory = base_path('/resources/lang/packages');
     foreach ($data as $namespace => $locales) {
         foreach ($locales as $group => $file) {
             $filename = pathinfo($file, PATHINFO_FILENAME);
             $fileDir = $langDirectory . DIRECTORY_SEPARATOR . $newLocale . DIRECTORY_SEPARATOR . $namespace;
             if (!$files->exists($fileDir)) {
                 $files->makeDirectory($fileDir, 0755, TRUE);
             }
             $files->copy($file, $fileDir . DIRECTORY_SEPARATOR . $filename . '.php');
         }
     }
 }
开发者ID:BlueCatTAT,项目名称:kodicms-laravel,代码行数:35,代码来源:GenerateLocalePackage.php

示例10: backup

 /**
  * Backup config file
  */
 protected function backup()
 {
     $from = $this->configFile;
     $pathinfo = pathinfo($from);
     $to = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php';
     $this->file->copy($from, $to);
 }
开发者ID:acacha,项目名称:laravel-utils,代码行数:10,代码来源:ConfigUpdater.php

示例11: fire

 public function fire()
 {
     $environment = $this->config->get('app.env');
     $gitSnifferEnv = $this->config->get('git-sniffer.env');
     if ($environment !== $gitSnifferEnv) {
         return;
     }
     $hooksDir = base_path('.git/hooks');
     if (!$this->files->isDirectory($hooksDir)) {
         $this->files->makeDirectory($hooksDir, 0755);
     }
     $preCommitHook = $hooksDir . '/pre-commit';
     $preCommitResource = $this->files->dirname(__DIR__) . '/resources/pre-commit';
     if ($this->files->exists($preCommitResource)) {
         $this->files->copy($preCommitResource, $preCommitHook);
     }
 }
开发者ID:avirdz,项目名称:laravel-git-sniffer,代码行数:17,代码来源:CopyHookCommand.php

示例12: createAnonymizer

 /**
  * Create Anonymizer class.
  *
  * @param string $dir
  *
  * @return void
  */
 protected function createAnonymizer($dir, $class)
 {
     $path = "{$dir}/{$class}.php";
     if ($this->files->exists($path)) {
         $this->error("File {$path} already exists");
         return;
     }
     $this->files->copy(__DIR__ . '/stubs/' . $class . '.stub', $path);
 }
开发者ID:arrilot,项目名称:laravel-data-anonymization,代码行数:16,代码来源:AnonymizationInstallCommand.php

示例13: copy

 /**
  * Function to copy files given in the template
  * configuration from the given source to the
  * given destination.  
  * 
  * The command will take into account if you are
  * copying files or directories and act accordingly
  * 
  * @return void
  */
 public function copy()
 {
     $key = str_replace(TemplateReader::STRUCTURE . '.', '', TemplateReader::STRUCTURE_COPY);
     $data = array_get($this->config, $key);
     foreach ($data as $cp) {
         $from = Path::absolute($cp['from'], $this->appDir);
         $to = Path::absolute($cp['to'], $this->appDir);
         $this->command->comment("Copy", "from {$from} to {$to}");
         if (!$this->filesystem->exists(dirname($to))) {
             $this->filesystem->makeDirectory(dirname($to), 0777, true);
         }
         if ($this->filesystem->isDirectory($from) && $this->filesystem->isDirectory($to)) {
             $this->filesystem->copyDirectory($from, $to);
         } else {
             $this->filesystem->copy($from, $to);
         }
     }
 }
开发者ID:dhaval48,项目名称:foreman,代码行数:28,代码来源:Structure.php

示例14: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // 確認是否有 api key
     if (null === $this->apiPublicKey) {
         $this->error('Invalid VirusTotal api public key.');
         return;
     }
     if (!$this->filesystem->isFile($file = $this->argument('file'))) {
         $this->error('File not exists.');
         return;
     }
     // 取得欲儲存的 Model
     if (null === ($model = $this->option('model'))) {
         $model = $this->ask('The Eloquent ORM Model');
     }
     // 取得欲儲存的欄位
     if (null === ($column = $this->option('column'))) {
         $column = $this->ask('The table\'s column to store the result');
     }
     // 取得欲儲存的欄位
     if (null === ($index = $this->option('index'))) {
         $index = $this->ask('The primary key\'s value to specific row');
     }
     // 檢查 Model 是否存在
     if (!class_exists($model)) {
         $this->error('Model not exists.');
         return;
     }
     $model = (new $model())->find($index);
     // 檢查該比資料是否存在
     if (null === $model) {
         $this->error('Model not exists');
         return;
     }
     // 檢查欄位是否存在
     if (!Schema::hasColumn($model->getTableName(), $column)) {
         $this->error('Column not exists.');
         return;
     }
     // 檢查是否有替代檔名
     if (null !== ($fakeName = $this->option('fakeName')) && strlen($fakeName) > 0) {
         $fakePath = temp_path($fakeName);
         $this->filesystem->copy($file, $fakePath);
         $file = $fakePath;
     }
     $virusTotal = new File($this->apiPublicKey);
     $report = $virusTotal->scan($file);
     $model->{$column} = $report['permalink'];
     $model->save();
     if (isset($fakePath)) {
         $this->filesystem->delete($fakePath);
     }
     $this->info('File scan successfully!');
 }
开发者ID:BePsvPT,项目名称:CCU,代码行数:59,代码来源:ScanFiles.php

示例15: getKeyFileArray

 /**
  * Get the key file and contents.
  *
  * @return array
  */
 public function getKeyFileArray()
 {
     $path = $this->getKeyFilePath();
     $defaultEnvFile = dirname(__FILE__) . "/../Files/.env.default.php";
     if (!$this->files->exists($path)) {
         $this->files->copy($defaultEnvFile, $path);
         // copy default file
     }
     $envConfig = $this->files->includeFile($path);
     return $envConfig;
 }
开发者ID:brunty,项目名称:laravel-environment,代码行数:16,代码来源:SetupEnvironmentVariablesCommand.php


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