本文整理汇总了PHP中eZPackage::repositoryPath方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPackage::repositoryPath方法的具体用法?PHP eZPackage::repositoryPath怎么用?PHP eZPackage::repositoryPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPackage
的用法示例。
在下文中一共展示了eZPackage::repositoryPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showWarning
//
// 'url' option
//
$packageURL = $scriptOptions['url'];
if (!$packageURL) {
$packageINI = eZINI::instance('package.ini');
$packageURL = $packageINI->variable('RepositorySettings', 'RemotePackagesIndexURL');
}
//
// 'auto-mode' option
//
global $autoMode;
$autoMode = $scriptOptions['auto-mode'];
if ($autoMode != 'off') {
$autoMode = 'on';
$importDir = eZPackage::repositoryPath() . "/{$packageRepository}";
showWarning("Processing in auto-mode: \n" . "- packages will be downloaded to '{$packageDir}';\n" . "- packages will be imported to '{$importDir}';\n" . "- installing of existing classes will be skipped;\n" . "- all files(extesion, design, downloaded and imported packages) will be overwritten;");
$action = getUserInput("Continue? [y/n]: ");
if (strpos($action, 'y') !== 0) {
$script->shutdown(0, 'Done');
}
}
/**************************************************************
* do the work *
***************************************************************/
if (downloadPackages($packageList, $packageURL, $packageDir, $packageRepository)) {
// install
installPackages($packageList);
}
if (file_exists(installScriptDir($packageRepository, 'ezwebin_site'))) {
include_once installScriptDir($packageRepository, 'ezwebin_site') . "/settings/ezwebininstaller.php";
示例2: downloadPackages
function downloadPackages($packageList, $packageURL, $packageDir, $packageRepository)
{
global $cli;
showMessage2("Configuring...");
if (!is_array($packageList) || count($packageList) == 0) {
showError("Package list is empty. Aborting...");
}
// 1. check if packages specified in $packageList exist in $packageRepository(means already downloaded and imported).
// if yes - ask user to do download or not. If not - go out
foreach (array_keys($packageList) as $k) {
$packageName = $packageList[$k];
$package = eZPackage::fetch($packageName);
if (is_object($package)) {
global $autoMode;
if ($autoMode == 'on') {
$action = 'y';
} else {
$action = getUserInput("Package '{$packageName}' already imported. Import it anyway? [y/n]: ");
}
if (strpos($action, 'n') === 0) {
unset($packageList[$k]);
} else {
eZDir::recursiveDelete(eZPackage::repositoryPath() . "/{$packageRepository}/{$packageName}");
}
}
}
if (count($packageList) == 0) {
// all packages are imported.
return true;
}
// 2. check $packgesList exists in $packageDir(means packages downloaded but not imported)
// if yes - ask user to import or not. If not - go out
if (!checkDir($packageDir)) {
return false;
}
$downloadPackageList = array();
foreach ($packageList as $packageName) {
if (file_exists("{$packageDir}/{$packageName}.ezpkg")) {
global $autoMode;
if ($autoMode == 'on') {
$action = 'y';
} else {
$action = getUserInput("Package '{$packageName}' already downloaded. Download it anyway? [y/n]: ");
}
if (strpos($action, 'n') === 0) {
continue;
}
}
$downloadPackageList[] = $packageName;
}
//
// download
//
showMessage2("Downloading...");
if (count($downloadPackageList) > 0) {
// TODO: using 'eZStepSiteTypes' is hack.
// need to exclude 'downloadFile' from that class.
$tpl = false;
$http = false;
$ini = false;
$persistenceList = false;
$downloader = new eZStepSiteTypes($tpl, $http, $ini, $persistenceList);
foreach ($downloadPackageList as $packageName) {
showMessage("{$packageName}");
$archiveName = $downloader->downloadFile("{$packageURL}/{$packageName}.ezpkg", $packageDir);
if ($archiveName === false) {
showError("download error - " . $downloader->ErrorMsg);
}
}
}
//
// import
//
showMessage2("Importing...");
foreach ($packageList as $packageName) {
showMessage("{$packageName}");
$package = eZPackage::import("{$packageDir}/{$packageName}.ezpkg", $packageName, false, $packageRepository);
if (!is_object($package)) {
showError("Faild to import '{$packageName}' package: err = {$package}");
}
}
return true;
}
示例3: packageRepositories
static function packageRepositories($parameters = array())
{
if (isset($parameters['path']) and $parameters['path']) {
$path = $parameters['path'];
$packageRepositories = array(array('path' => $path, 'id' => 'local', 'name' => ezpI18n::tr('kernel/package', 'Local'), 'type' => 'local'));
} else {
$repositoryPath = eZPackage::repositoryPath();
$packageRepositories = array(array('path' => $repositoryPath . '/local', 'id' => 'local', 'name' => ezpI18n::tr('kernel/package', 'Local'), 'type' => 'local'));
$subdirs = eZDir::findSubitems($repositoryPath, 'd');
foreach ($subdirs as $dir) {
if ($dir == 'local') {
continue;
}
$packageRepositories[] = array('path' => $repositoryPath . '/' . $dir, 'id' => $dir, 'name' => $dir, 'type' => 'global');
}
}
return $packageRepositories;
}