本文整理汇总了PHP中copydirr函数的典型用法代码示例。如果您正苦于以下问题:PHP copydirr函数的具体用法?PHP copydirr怎么用?PHP copydirr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copydirr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_time_limit
set_time_limit(0);
require_once 'config.inc.php';
require_once 'include/utils/utils.php';
require_once 'include/database/PearDatabase.php';
require 'copydirr.inc.php';
require 'modules/Memdays/MemdaysDataPopulator.php';
global $root_directory;
global $adb;
///
if (isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '') {
$current_language = $_SESSION['authenticated_user_language'];
} else {
$current_language = $default_language;
}
copydirr($root_directory . "modules/Memdays/Smarty/templates/", $root_directory . "Smarty/templates/");
//增加cache/application/language/zh_cn.lang.php中所需要的选项
$language_file_path = $root_directory . "cache/application/language/" . $current_language . ".lang.php";
if (!is_file($language_file_path)) {
touch($language_file_path);
}
$language_file_path = $root_directory . "cache/application/language/" . $current_language . ".lang.php";
if (!is_file($language_file_path)) {
touch($language_file_path);
}
if (is_writable($language_file_path)) {
$custom_app_strings = return_custom_application_language($current_language);
$custom_applist_strings = return_custom_app_list_strings_language($current_language);
if (is_array($custom_app_strings) && count($custom_app_strings) > 0 || is_array($custom_applist_strings) && count($custom_applist_strings) > 0) {
$bk = chr(10);
// The sign of line break
示例2: array
$libraries = array('net', 'serial', 'video', 'dxf', 'pdf', 'sound', 'io');
$lib_dir = DISTDIR . 'libraries';
// Create Library index
$index = CONTENTDIR . "api_en/libraries/index.html";
$page = new LocalPage('Libraries', 'Libraries', 'Libraries', '../');
$page->content(file_get_contents($index));
writeFile('distribution/libraries/index.html', $page->out());
// For each Library
foreach ($libraries as $lib) {
$source = "api_en/LIB_{$lib}";
$destination = "libraries/{$lib}";
//make_necessary_directories(DISTDIR.$destination.'/images/include');
$index = CONTENTDIR . $source . '/index.html';
$page = new LocalPage(ucfirst($lib) . ' \\ Libraries', 'Libraries', 'Libraries', '../../');
$page->content(file_get_contents($index));
writeFile('distribution/' . $destination . '/index.html', $page->out());
}
if (is_dir(DISTDIR . 'libraries/images')) {
rmdir(DISTDIR . 'libraries/images');
}
mkdir(DISTDIR . 'libraries/images', 0755);
copydirr(CONTENTDIR . "api_en/libraries/images", DISTDIR . 'libraries/images');
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Local library generation successful!</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>
示例3: copy_media
function copy_media()
{
if (file_exists($this->data_dir)) {
if (!copydirr($this->data_dir, EXAMPLESDIR . '/')) {
echo "Could not copy" . EXAMPLESDIR . '/' . "<br />";
}
} else {
//echo "No data here: " . $this->data_dir . "<br />";
}
}
示例4: microtime_float
<?php
require_once '../config.php';
require_once 'lib/Translation.class.php';
require_once './contributions.php';
$benchmark_start = microtime_float();
$tools_dir = 'reference/tools';
$index = CONTENTDIR . "api_en/tools/index.html";
$page = new Page('Tools', 'Tools', 'Tools');
$page->content(file_get_contents($index));
//make_necessary_directories(BASEDIR.$tools_dir.'/images/include.php');
writeFile($tools_dir . '/index.html', $page->out());
if (!is_dir(BASEDIR . $tools_dir . '/images')) {
mkdir(BASEDIR . $tools_dir . '/images', 0757);
}
copydirr(CONTENTDIR . "api_en/tools/images", BASEDIR . $tools_dir . '/images');
// copy over the files for the contributed libraries
copy(CONTENTDIR . "static/tools.html", BASEDIR . $tools_dir . '/tools.html');
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Tool Generation Successful</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>
示例5: copydirr
function copydirr($fromDir, $toDir, $chmod = 0757, $verbose = false)
{
//* Check for some errors
$errors = array();
$messages = array();
if (!is_writable($toDir)) {
$errors[] = 'target ' . $toDir . ' is not writable';
}
if (!is_dir($toDir)) {
$errors[] = 'target ' . $toDir . ' is not a directory';
}
if (!is_dir($fromDir)) {
$errors[] = 'source ' . $fromDir . ' is not a directory';
}
if (!empty($errors)) {
if ($verbose) {
foreach ($errors as $err) {
echo '<strong>Error</strong>: ' . $err . '<br />';
}
}
return false;
}
//*/
$exceptions = array('.', '..');
//* Processing
$handle = opendir($fromDir);
while (false !== ($item = readdir($handle))) {
if (!in_array($item, $exceptions)) {
//* cleanup for trailing slashes in directories destinations
$from = str_replace('//', '/', $fromDir . '/' . $item);
$to = str_replace('//', '/', $toDir . '/' . $item);
//*/
if (is_file($from)) {
if (@copy($from, $to)) {
chmod($to, $chmod);
touch($to, filemtime($from));
// to track last modified time
$messages[] = 'File copied from ' . $from . ' to ' . $to;
} else {
$errors[] = 'cannot copy file from ' . $from . ' to ' . $to;
}
}
if (is_dir($from)) {
if (@mkdir($to)) {
chmod($to, $chmod);
$messages[] = 'Directory created: ' . $to;
} else {
$errors[] = 'cannot create directory ' . $to;
}
copydirr($from, $to, $chmod, $verbose);
}
}
}
closedir($handle);
//*/
//* Output
if ($verbose) {
foreach ($errors as $err) {
echo '<strong>Error</strong>: ' . $err . '<br />';
}
foreach ($messages as $msg) {
echo $msg . '<br />';
}
}
//*/
return true;
}
示例6: microtime_float
<?php
require_once '../config.php';
require_once 'lib/Translation.class.php';
$benchmark_start = microtime_float();
$tools_dir = DISTDIR . 'tools';
// Create Tools index
$index = CONTENTDIR . "api_en/tools/index.html";
$page = new LocalPage('Tools', 'Tools', 'Tools', '../');
$page->content(file_get_contents($index));
writeFile('distribution/tools/index.html', $page->out());
// Create folder for images and copy them over
if (is_dir(DISTDIR . 'tools/images')) {
rmdir(DISTDIR . 'tools/images');
}
mkdir(DISTDIR . 'tools/images', 0755);
copydirr(CONTENTDIR . 'api_en/tools/images', DISTDIR . 'tools/images');
// Copy file for the contributed Tools
require_once './contributions.php';
copy(CONTENTDIR . "static/tools.html", DISTDIR . 'tools/tools.html');
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Local tool generation successful!</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>
示例7: putenv
$source = CONTENTDIR;
$path = BASEDIR;
$where = CONTENTDIR;
$there = CONTENTDIR;
putenv('HOME=' . CONTENTDIR);
//`cd $there && /usr/bin/svn update curated.xml`;
//`cd $there && /usr/bin/svn update curated_images/`;
// Switch from SVN to GIT, 14 FEB 2013
// Disabled for now, so we can test generate scripts without pulling latest from repo. -SM
//`cd $path && /usr/bin/git pull https://github.com/processing/processing-docs/`;
// Copy over the images for the tutorials index
if (!is_dir($path . 'exhibition/images')) {
mkdir($path . 'exhibition/images', '0757');
}
if (is_dir($path . 'exhibition/images')) {
copydirr($source . 'curated_images', $path . 'exhibition/images', null, 0757, true);
}
/******************************************** CURATED ***/
function get_curated($curated, $start = 0, $num = 12)
{
// output html
$html = '<table width="448" cellspacing="0" cellpadding="0" border="0">';
$j = 0;
for ($i = $start; $i < $start + $num; $i++) {
if ($curated[$i]) {
if ($j % 2 == 0) {
$html .= '<tr>';
}
$html .= '<td>' . $curated[$i]->display() . '</td>';
if ($j % 2 != 0) {
$html .= '</tr>';
示例8: installvirtuemart
//.........这里部分代码省略.........
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8cb8d644ef299639b7eab25829d13dbc.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8d886c5855770cc01a3b8a2db57f6600.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/9a4448bb13e2f7699613b2cfd7cd51ad.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/520efefd6d7977f91b16fac1149c7438.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8147a3a9666aec0296525dbd81f9705e.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8716aefc3b0dce8870360604e6eb8744.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/480655b410d98a5cc3bef3927e786866.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/578563851019e01264a9b40dcf1c4ab6.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/a04395a8aefacd9c1659ebca4dbfd4ba.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/b4a748303d0d996b29d5a1e1d1112537.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/c3a5bf074da14f30c849d13a2dd87d2c.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/c70a3f47baf9a4020aeeee919eb3fda4.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/cca3cd5db813ee6badf6a3598832f2fc.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/dccb8223891a17d752bfc1477d320da9.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/e614ba08c3ee0c2adc62fd9e5b9440eb.jpg");
@unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/ffd5d5ace2840232c8c32de59553cd8d.jpg");
}
/**
* mambo-phpShop => VirtueMart
*
* Section to copy your images,
* and convert important entries
* and place redirection files to keep your links
* like &option=com_phpshop&product_id=1&Itemid=45 alive.
*/
if ($install_type != 'newinstall' && is_dir($mosConfig_absolute_path . '/components/com_phpshop')) {
require_once $mosConfig_absolute_path . '/administrator/components/com_virtuemart/install.copy.php';
// COPY all Images from /componentes/com_phpshop/shop_image/*
// TO /components/com_virtuemart/shop_image/*
$fromDir = $mosConfig_absolute_path . '/components/com_phpshop/shop_image';
$toDir = $mosConfig_absolute_path . '/components/com_virtuemart/shop_image';
$perms = 0777;
umask(022);
copydirr($fromDir, $toDir, $perms, true);
// COPY templates from /administrator/components/com_phpshop/templates
// TO /administrator/components/com_virtuemart/templates
$fromDir = $mosConfig_absolute_path . '/administrator/components/com_phpshop/html/templates';
$toDir = $mosConfig_absolute_path . '/administrator/components/com_virtuemart/html/templates';
copydirr($fromDir, $toDir, $perms, true);
// COPY&RENAME the configuration file phpshop.cfg.php
// TO virtuemart.cfg.php AND replace 'com_phpshop' by 'com_virtuemart'
$fromDir = $mosConfig_absolute_path . '/administrator/components/com_phpshop';
$toDir = $mosConfig_absolute_path . '/administrator/components/com_virtuemart';
$config_contents = str_replace('com_phpshop', 'com_virtuemart', file_get_contents($fromDir . '/phpshop.cfg.php'));
$config_contents .= "<?php\n@define('VM_TABLEPREFIX', 'vm' );\ndefine('VM_PRICE_SHOW_PACKAGING_PRICELABEL', '1' );\ndefine('VM_PRICE_SHOW_INCLUDINGTAX', '1' );\ndefine('VM_PRICE_ACCESS_LEVEL', 'Public Frontend' );\ndefine('VM_SILENT_REGISTRATION', '1');\n?>";
file_put_contents($toDir . '/virtuemart.cfg.php', $config_contents);
// BACKUP
// phpshop.php TO phpshop~.php.
// AND phpshop_parser.php TO phpshop_parser~.php.
$fromDir = $mosConfig_absolute_path . '/components/com_phpshop';
if (!is_writable($fromDir . '/phpshop.php')) {
@chmod($fromDir . '/phpshop.php', '0777');
}
if (!is_writable($fromDir . '/phpshop_parser.php')) {
@chmod($fromDir . '/phpshop_parser.php', '0777');
}
if (!rename($fromDir . '/phpshop.php', $fromDir . '/phpshop~.php')) {
}
// CREATE A NEW FILE 'phpshop.php', to handle permanent Redirect to
// FROM index.php?option=com_phpshop&...
// TO index.php?option=com_virtuemart&...
$contents = "<?php\nif( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) {\n\tdie( 'Acesso direto a '.basename(__FILE__).' não é permitido.' );\n}\n\nglobal \$mosConfig_absolute_path;\n\n\$newURL = str_replace( 'com_phpshop', 'com_virtuemart', \$_SERVER['QUERY_STRING'] );\n\nheader( 'HTTP/1.1 301 Moved Permanently' );\nheader( 'Location: '.\$mosConfig_live_site.\"/\".basename( \$_SERVER['PHP_SELF'] ).'?'.\$newURL );\nexit();\n\n?>\n";
if (file_put_contents($fromDir . '/phpshop.php', $contents)) {
$messages[] = "Estabelecido o redirecionamento dos links do antigo phpshop para os links do novo virtuemart";
} else {
$messages[] = "Aviso: Não foi possível estabelecer o redirecionamento dos links do antigo phpshop para os links do novo virtuemart";
示例9: microtime_float
<?php
require_once '../config.php';
require 'lib/Translation.class.php';
$benchmark_start = microtime_float();
// make overview page
$source = CONTENTDIR . "api_en/environment/";
$path = REFERENCEDIR . "/environment/";
make_necessary_directories($path . "images/file");
$page = new Page("Environment (IDE)", "Environment", "Environment", '../../');
$page->content(file_get_contents($source . "index.html"));
$page->language("en");
writeFile('reference/environment/index.html', $page->out());
copydirr($source . '/images', $path . '/images');
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Environment page generation Successful</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>
示例10: uploadPackage
function uploadPackage()
{
$absolute_path = JPATH_ROOT;
//echo $absolute_path;
$userfile = JRequest::getVar('userfile', null, 'files', 'array');
if (!$userfile) {
exit;
}
//echo $userfile_name;
$msg = '';
move_uploaded_file($userfile['tmp_name'], $absolute_path . '/tmp/' . $userfile['name']);
//$resultdir = uploadFile( $userfile['tmp_name'], $userfile['name'], $msg );
$msg = extractArchive($userfile['name']);
if (file_exists($msg . "/swmenufree.xml")) {
$upload_version = get_Version($msg . "/swmenufree.xml");
} else {
$upload_version = 0;
}
// echo $msg;
$current_version = get_Version($absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml');
//echo $upload_version;
if ($current_version < $upload_version) {
if (copydirr($msg . "/admin/", $absolute_path . '/administrator/components/com_swmenufree', false)) {
unlink($absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml');
unlink($absolute_path . '/administrator/components/com_swmenufree/admin.swmenufree.php');
copy($msg . "/swmenufree.xml", $absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml');
$message = _SW_COMPONENT_SUCCESS;
} else {
$message = _SW_COMPONENT_FAIL;
}
} else {
$message = _SW_INVALID_FILE;
}
sw_deldir($msg);
unlink($absolute_path . "/tmp/" . $userfile['name']);
echo "<dl id=\"system-message\"><dt class=\"message\">Message</dt>\n\t\t<dd class=\"message message fade\"><ul><li>" . $message . "</li>\n\t </ul></dd></dl>\n";
//editCSS($id, $option);
upgrade('com_swmenufree');
}
示例11: array
//`cd $where && /usr/bin/svn update libraries.html`;
// Switch from SVN to GIT, 14 FEB 2013
`cd {$path} && /usr/bin/git pull https://github.com/processing/processing-web/`;
$libraries = array('net', 'serial', 'video', 'dxf', 'pdf');
$lib_dir = REFERENCEDIR . 'libraries/';
// Create Index
$index = CONTENTDIR . "api_en/libraries/index.html";
$page = new Page('Libraries', 'Libraries');
$page->content(file_get_contents($index));
make_necessary_directories(BASEDIR . $lib_dir . '/images/include.php');
writeFile($lib_dir . 'index.html', $page->out());
if (is_dir($lib_dir . 'images')) {
rmdir($lib_dir . 'images');
}
mkdir($lib_dir . 'images', 0755);
copydirr(CONTENTDIR . "api_en/libraries/images", $lib_dir . 'images');
// copy over the file for the contributed libraries
require_once './contributions.php';
copy(CONTENTDIR . "static/libraries.html", $lib_dir . 'libraries.html');
// For each Library
foreach ($libraries as $lib) {
$source = "api_en/LIB_{$lib}";
$destination = "libraries/{$lib}";
make_necessary_directories(REFERENCEDIR . $destination . '/images/include');
// template and copy index
$index = CONTENTDIR . $source . '/index.html';
if ($lib == 'pdf' || $lib == 'dxf') {
//$page = new Page(strtoupper($lib) . ' \\ Libraries', 'Libraries', 'Library-index');
$page = new Page(strtoupper($lib) . ' \\ Libraries', 'Libraries');
} else {
//$page = new Page(ucfirst($lib) . ' \\ Libraries', 'Library-index');
示例12: microtime_float
<?php
require_once '../config.php';
require 'lib/Translation.class.php';
$benchmark_start = microtime_float();
$source = CONTENTDIR . "api_en/environment/";
$path = DISTDIR . "/environment/";
$page = new LocalPage('Environment (IDE)', 'Environment', 'Environment', '../');
$page->content(file_get_contents($source . 'index.html'));
$page->language('en');
writeFile($path . 'index.html', $page->out());
if (is_dir(DISTDIR . 'environment/images')) {
rmdir(DISTDIR . 'environment/images');
}
mkdir(DISTDIR . 'environment/images', 0755);
copydirr($source . 'images', DISTDIR . 'environment/images');
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Local environment page generation successful!</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>
示例13: mkdir
if ($imgs == 'true') {
$newpath = $path . 'tutorials/' . $directory . '/imgs';
if (!is_dir($newpath)) {
mkdir($newpath, 0757);
}
if (is_dir($newpath)) {
copydirr($source . $directory . '/imgs', $newpath, null, 0757, true);
}
}
if ($code == 'true') {
$newpath = $path . 'tutorials/' . $directory . '/code';
if (!is_dir($newpath)) {
mkdir($newpath, 0757);
}
if (is_dir($newpath)) {
copydirr($source . $directory . '/code', $newpath, null, 0757, true);
}
}
}
}
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Static page generation Successful</h2>
<h2>Updated <?php
echo $where;
?>
</h2>
<p>Generated files in <?php
echo $execution_time;
示例14: copydirr
copydirr($source . 'curves/code', $path . 'learning/curves/code', true, 0757, true);
}
$page = new Page("Anatomy", "Tutorials");
$page->content(file_get_contents($source . "anatomy/index.html"));
writeFile('learning/anatomy/index.html', $page->out());
if (!is_dir($path . 'learning/anatomy/imgs')) {
mkdir($path . 'learning/anatomy/imgs', '0757');
}
if (is_dir($path . 'learning/anatomy/imgs')) {
copydirr($source . 'anatomy/imgs', $path . 'learning/anatomy/imgs', null, 0757, true);
}
if (!is_dir($path . 'learning/anatomy/code')) {
mkdir($path . 'learning/anatomy/code', '0757');
}
if (is_dir($path . 'learning/anatomy/code')) {
copydirr($source . 'anatomy/code', $path . 'learning/anatomy/code', true, 0757, true);
}
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Static page generation Successful</h2>
<h2>Updated <?php
echo $where;
?>
</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>
<!--<p>Page put here: <?php
示例15: writeFile
$page->content(file_get_contents($source . "books.html"));
writeFile('books/index.html', $page->out());
// Copy over the errata file for Processing: A Programming Handbook...
copy($source . 'processing-errata.txt', $path . 'books/processing-errata.txt');
// Copy over the media.zip file for Getting Started with Processing...
copy($source . 'media.zip', $path . 'books/media.zip');
$page = new Page("Copyright", "Copyright");
$page->content(file_get_contents($source . "copyright.html"));
writeFile('copyright.html', $page->out());
// Copy over the images for the shop index
if (!is_dir($path . 'shop')) {
mkdir($path . 'shop', 0757);
}
if (!is_dir($path . 'shop/imgs')) {
mkdir($path . 'shop/imgs', 0757);
}
if (is_dir($path . 'shop/imgs')) {
copydirr($source . 'shop/imgs', $path . 'shop/imgs', null, 0757, false);
}
$page = new Page("Shop", "Shop");
$page->content(file_get_contents($source . 'shop/' . "index.html"));
writeFile('shop/index.html', $page->out());
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Static page generation Successful</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>