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


PHP utils::cp方法代码示例

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


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

示例1: multi_dump_sdf

 public function multi_dump_sdf($appId, $bakdir)
 {
     $dirname = $bakdir . '/sdf';
     $dbschema_dirname = $bakdir . '/dbschema';
     is_dir($dirname) or mkdir($dirname, 0755, true);
     is_dir($dbschema_dirname) or mkdir($dbschema_dirname, 0755, true);
     $appIds = array_column(app::get('base')->database()->executeQuery('SELECT app_id FROM base_apps WHERE status=?', ['active'])->fetchAll(), 'app_id');
     if ($appId) {
         $appIds = array_slice($appIds, array_flip($appIds)[$appId]);
         $nextAppId = next($appIds);
     } else {
         $appId = current($appIds);
         $nextAppId = next($appIds);
     }
     if ($appId === false) {
         return false;
     }
     if (is_dir(APP_DIR . '/' . $appId . '/dbschema')) {
         foreach (with(new base_application_dbtable())->detect($appId) as $item) {
             //echo $item->key();
             $columnDefine = $item->load();
             $this->dump_data($dirname, $appId, $item->key());
         }
         utils::cp(APP_DIR . '/' . $appId . '/dbschema', $dbschema_dirname . '/' . $appId);
     }
     return $nextAppId;
 }
开发者ID:453111208,项目名称:bbc,代码行数:27,代码来源:mysqldumper.php

示例2: post_install

 public function post_install()
 {
     logger::info('Initial ectools');
     kernel::single('base_initial', 'ectools')->init();
     logger::info('Initial Regions');
     kernel::single('ectools_regions_mainland')->install();
     if (!is_dir(DATA_DIR . '/misc')) {
         utils::mkdir_p(DATA_DIR . '/misc');
     }
     utils::cp(app::get('ectools')->res_dir . '/js/region_data.js', DATA_DIR . '/misc/region_data.js');
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:11,代码来源:task.php

示例3: command_app

 function command_app($app_name = null)
 {
     if (!$app_name) {
         $app_name = readline('app name: ');
     }
     do {
         $app_path = APP_DIR . '/' . $app_name;
         $app_path = realpath($app_path);
     } while (!$appname && strlen($app_path) >= strlen(APP_DIR) && file_exites($app_path));
     $base_dir = APP_DIR . '/base';
     logger::info('Init App...' . $app_name);
     utils::cp($base_dir . '/examples/app', APP_DIR . '/' . $app_name);
     utils::replace_p(APP_DIR . '/' . $project_name, array('%*APP_NAME*%' => $project_name));
     logger::info('. done!');
     return true;
 }
开发者ID:453111208,项目名称:bbc,代码行数:16,代码来源:create.php

示例4: init

 function init($name, $template)
 {
     switch ($template) {
         case 'desktop':
             $source_dir = APP_DIR . '/base/examples/app';
             break;
         case 'storage':
             $source_dir = APP_DIR . '/base/examples/app';
             break;
         case 'cache':
             $source_dir = APP_DIR . '/base/examples/app';
             break;
         default:
             $source_dir = APP_DIR . '/base/examples/app';
     }
     kernel::log('Creating application ' . $name . '...');
     utils::cp($source_dir, APP_DIR . '/' . $name);
     utils::replace_p(APP_DIR . '/' . $name, array('' => $name));
     kernel::log('ok.');
     return APP_DIR . '/' . $name;
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:21,代码来源:apptmpl.php

示例5: download

 public function download($app_id, $force = false)
 {
     $download_able = $force;
     if (!$download_able) {
         $download_able = !file_exists(APP_DIR . '/' . $app_id . '/app.xml');
         if (!$download_able) {
             $rows = app::get('base')->model('apps')->getList('app_id,local_ver,remote_ver', array('app_id' => $app_id), 0, 1);
             $download_able = $rows[0]['local_ver'] ? version_compare($rows[0]['remote_ver'], $rows[0]['local_ver'], '>') : true;
         }
     }
     if ($download_able) {
         $tmpfile = tempnam(TMP_DIR, 'app_');
         $tmpdir = tempnam(TMP_DIR, 'app_');
         $download_result = kernel::single('base_pget')->dl(sprintf(URL_APP_FETCH, $app_id), $tmpfile);
         if (!$download_result) {
             logger::info('Appliction [' . $app_id . '] download failed.');
             exit;
         }
         $broken = false;
         logger::info("\nExtra from package.");
         foreach (base_package::walk($tmpfile) as $file) {
             if (!$file) {
                 $broken = true;
                 break;
             }
             logger::info($file['name']);
             base_package::extra($file, $tmpdir);
         }
         if (!$broken && file_exists($tmpdir . '/app.xml')) {
             if (!is_dir(DATA_DIR . '/backup')) {
                 utils::mkdir_p(DATA_DIR . '/backup');
             }
             utils::cp(APP_DIR . '/' . $app_id, DATA_DIR . '/backup/app.' . $app_id . '.' . time());
             utils::remove_p(APP_DIR . '/' . $app_id);
             utils::cp($tmpdir, APP_DIR . '/' . $app_id);
             utils::remove_p($tmpdir);
             $this->update_local_app_info($app_id);
             return true;
         } else {
             utils::remove_p($tmpdir);
             return false;
         }
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:44,代码来源:manage.php

示例6: command_model

 function command_model()
 {
     if (!($args_input = array_shift(func_get_args()))) {
         echo app::get('dev')->_("参数不能为空\n");
         echo app::get('dev')->_("用法是: dev:generate model app名(必须):模型层文件夹名:模型层类名(必须):方法名");
         return false;
     }
     $args = explode(':', $args_input);
     if (count($args) != 4) {
         echo app::get('dev')->_("为空的值也必须占位,格式强制为:\n dev:generate model app名(必须):模型层文件夹名:模型层类名(必须):方法名:") . "\n";
         return false;
     }
     if (!($app_name = trim($args['0']))) {
         echo app::get('dev')->_("app名不能为空,请重新输入") . "\n";
         return false;
     }
     $mdl_dir = trim(trim(trim($args['1']), '/'));
     if (!($mdl_name = trim($args['2']))) {
         echo app::get('dev')->_("模型层类名不能为空,请重新输入") . "\n";
         return false;
     }
     if (!($func_name = trim($args['3']))) {
         $func_name = 'default';
     }
     $replace_map = array('%*APP_NAME*%' => $app_name, '%*MDL_NAME*%' => $mdl_name, '%*FUNC_NAME*%' => $func_name);
     //目录为空的时候以"."代替,防止路径出错
     if ($mdl_dir != '') {
         $replace_map['%*MDL_DIR*%'] = str_replace("/", "_", $mdl_dir) . "_";
     } else {
         $replace_map['%*MDL_DIR*%'] = '.';
     }
     $src = APP_DIR . "/dev/demo";
     $dst = APP_DIR . "/" . $app_name;
     if (!file_exists($dst)) {
         echo app::get('dev')->_("找不到 名为  {$app_name} 的app ");
         return false;
     }
     $src_sample_mdl_path = "{$src}/sample_mdl.php";
     //demo下的后台控制器sample文件路径
     $dst_sample_mdl_path = "{$dst}/model/{$mdl_dir}/sample_mdl.php";
     //新建的app下的后台控制器sample文件路径
     $dst_mdl_path = "{$dst}/model/{$mdl_dir}/{$mdl_name}.php";
     //新建的app的控制器文件路径
     if (file_exists($dst_mdl_path)) {
         echo app::get('dev')->_("模型层类  {$mdl_name}.php 已经存在 ") . "\n";
         do {
             $install_confirm = readline('是否覆盖? [Y/n] ');
             switch (strtolower(trim($install_confirm))) {
                 case 'y':
                     $install_confirm = true;
                     $command_succ = true;
                     break;
                 case 'n':
                     $install_confirm = false;
                     $command_succ = true;
                     break;
                 default:
                     $command_succ = false;
             }
         } while (!$command_succ);
         if (!$install_confirm) {
             return false;
         }
     }
     kernel::log('开始创建模型层...');
     $this->mkdir_r("{$dst}/model/{$mdl_dir}", 0755);
     utils::cp($src_sample_mdl_path, $dst_sample_mdl_path);
     rename($dst_sample_mdl_path, $dst_mdl_path);
     utils::replace_in_file($dst_mdl_path, $replace_map);
     kernel::log("创建模型层文件  {$mdl_name}.php");
     kernel::log("创建完成!");
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:72,代码来源:new.php

示例7: command_createproject

 function command_createproject($project_path = null, $install_confirm = null)
 {
     if (!$project_path) {
         $project_path = readline('Project path: ');
     }
     while (file_exists($project_path)) {
         $project_path = readline('Project already exists. enter anthoer one: ');
     }
     $project_name = basename($project_path);
     //init files
     $base_dir = dirname(__FILE__) . '/../../';
     kernel::log('Init project... ' . realpath($project_path . '/' . $project_name), 1);
     utils::cp($base_dir . '/examples/project', $project_path);
     utils::cp($base_dir, $project_path . '/app/base');
     utils::cp($base_dir . '/examples/app', $project_path . '/app/' . $project_name);
     chmod($project_path . '/app/base/cmd', 0744);
     chmod($project_path . '/data', 0777);
     utils::replace_p($project_path . '/config', array('' => $project_name));
     utils::replace_p($project_path . '/app/' . $project_name, array('' => $project_name));
     kernel::log('. done!');
     if ($install_confirm === null) {
         do {
             $install_confirm = readline('Install now? [Y/n] ');
             switch (strtolower(trim($install_confirm))) {
                 case '':
                 case 'y':
                     $install_confirm = true;
                     $command_succ = true;
                     break;
                 case 'n':
                     $install_confirm = false;
                     $command_succ = true;
                     break;
                 default:
                     $command_succ = false;
             }
         } while (!$command_succ);
     }
     $install_command = 'app' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'cmd install ' . $project_name;
     if ($install_confirm) {
         kernel::log('Installing...');
         kernel::log("\n" . $project_path . ' > ' . $install_command . "\n");
         chdir($project_path);
         passthru($install_command);
     } else {
         "Change dir to {$project_dir}: " . $install_command;
     }
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:48,代码来源:buildin.php

示例8: write_config

 public static function write_config()
 {
     return utils::cp(ROOT_DIR . '/app/base/examples/queue.php', ROOT_DIR . '/config/queue.php');
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:4,代码来源:queue.php

示例9: copyTheme

 /**
  * 复制CPS模板
  * @access private
  * @param string $theme 安装的模板名
  */
 private function copyTheme($theme)
 {
     $themeDir = app::get('cps')->app_dir . '/init_tmpl';
     $destDir = ROOT_DIR . '/themes/' . $theme;
     utils::cp($themeDir, $destDir);
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:11,代码来源:inst.php

示例10: multi_dump_sdf

 public function multi_dump_sdf($app, $bakdir)
 {
     $dirname = $bakdir . '/sdf';
     $dbschema_dirname = $bakdir . '/dbschema';
     is_dir($dirname) or mkdir($dirname, 0755, true);
     is_dir($dbschema_dirname) or mkdir($dbschema_dirname, 0755, true);
     $sql = 'SELECT app_id FROM sdb_base_apps WHERE status=\'active\'';
     $tables = $this->_db->select($sql);
     if ($app) {
         foreach ($tables as $key => $name) {
             if ($app == $name['app_id']) {
                 $tables = array_slice($tables, $key);
                 break;
             }
         }
     }
     $i = 0;
     foreach ($tables as $key => $tbl) {
         $app = $tbl['app_id'];
         $service = false;
         foreach (kernel::servicelist('desktop_backup.' . $app) as $object) {
             $service = true;
             $m = substr(get_class($object), strpos(get_class($object), $app) + strlen($app) + strlen('_mdl_'));
             $this->dump_data($dirname, $app, $m);
         }
         if (!$service) {
             if (!is_dir(APP_DIR . '/' . $app . '/dbschema')) {
                 if (count($tables) == 1) {
                     return false;
                 } else {
                     $arr = $tables[$key + 1];
                     return $arr['app_id'];
                 }
                 break;
             }
             if ($handle = opendir(APP_DIR . '/' . $app . '/dbschema')) {
                 chdir(APP_DIR . '/' . $app . '/dbschema');
                 while (false !== ($file = readdir($handle))) {
                     if ($file[0] != '.') {
                         if (strtolower(substr($file, -strpos(strrev($file), '.'))) != 'php') {
                             if (count($tables) == 1) {
                                 return false;
                             } else {
                                 $arr = $tables[$key + 1];
                                 return $arr['app_id'];
                             }
                             break;
                         }
                         require $file;
                     }
                 }
                 closedir($handle);
             }
             if (!is_array($db)) {
                 if (count($tables) == 1) {
                     return false;
                 } else {
                     $arr = $tables[$key + 1];
                     return $arr['app_id'];
                 }
                 break;
             }
             foreach ($db as $m => $row) {
                 if ($row['unbackup']) {
                     continue;
                 }
                 $this->dump_data($dirname, $app, $m);
             }
         }
         utils::cp(APP_DIR . '/' . $app . '/dbschema', $dbschema_dirname . '/' . $app);
         if (count($tables) == 1) {
             return false;
         } else {
             $arr = $tables[$key + 1];
             return $arr['app_id'];
         }
     }
     return false;
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:79,代码来源:mysqldumper.php


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