當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。