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


PHP Tiki_Profile::fromNames方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $profileName = $input->getArgument('profile');
     $repository = $input->getArgument('repository');
     $force = $input->getOption('force');
     $profile = \Tiki_Profile::fromNames($repository, $profileName);
     if (!$profile) {
         $output->writeln('<error>Profile not found.</error>');
         return;
     }
     $tikilib = \TikiLib::lib('tiki');
     $installer = new \Tiki_Profile_Installer();
     $isInstalled = $installer->isInstalled($profile);
     if ($isInstalled && $force) {
         $installer->forget($profile);
         $isInstalled = false;
     }
     if (!$isInstalled) {
         $transaction = $tikilib->begin();
         if ($installer->install($profile)) {
             $transaction->commit();
             $output->writeln('Profile applied.');
         } else {
             $output->writeln("<error>Installation failed:</error>");
             foreach ($installer->getFeedback() as $error) {
                 $output->writeln("<error>{$error}</error>");
             }
         }
     } else {
         $output->writeln('<info>Profile was already applied. Nothing happened.</info>');
     }
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:32,代码来源:ProfileInstallCommand.php

示例2: getProfiles

 function getProfiles(array $channelNames)
 {
     $profiles = array();
     foreach ($channelNames as $channelName) {
         $info = $this->channels[$channelName];
         if ($profile = Tiki_Profile::fromNames($info['domain'], $info['profile'])) {
             $profiles[$channelName] = $profile;
         }
     }
     return $profiles;
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:11,代码来源:channellib.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $addon_utilities = new \TikiAddons_Utilities();
     $addonName = $input->getArgument('addon');
     if (strpos($addonName, '/') !== false && strpos($addonName, '_') === false) {
         $package = $addonName;
         $folder = str_replace('/', '_', $addonName);
     } else {
         $package = str_replace('_', '/', $addonName);
         $folder = $addonName;
     }
     $repository = 'file://addons/' . $folder . '/profiles';
     $reapply = $input->getOption('reapply');
     $ignoredepends = $input->getOption('ignoredepends');
     if (empty(glob(TIKI_PATH . '/addons/' . $folder . '/profiles/*.yml'))) {
         $output->writeln("<error>No profiles found.</error>");
         return false;
     }
     if (!$ignoredepends) {
         $addon_utilities->checkDependencies($folder);
     }
     $addons = \TikiAddons::getInstalled();
     $tikilib = \TikiLib::lib('tiki');
     $installer = new \Tiki_Profile_Installer();
     foreach (glob(TIKI_PATH . '/addons/' . $folder . '/profiles/*.yml') as $file) {
         $profileName = str_replace('.yml', '', basename($file));
         $profile = \Tiki_Profile::fromNames($repository, $profileName);
         if (!$profile) {
             $output->writeln("<error>Profile {$profileName} not found.</error>");
             continue;
         }
         $isInstalled = $installer->isInstalled($profile);
         if ($isInstalled && $reapply) {
             $installer->forget($profile);
             $isInstalled = false;
         }
         if (!$isInstalled) {
             $transaction = $tikilib->begin();
             if ($installer->install($profile)) {
                 $addon_utilities->updateProfile($folder, $addons[$package]->version, $profileName);
                 $transaction->commit();
                 $output->writeln("Profile {$profileName} applied.");
             } else {
                 $output->writeln("<error>Profile {$profileName} installation failed:</error>");
                 foreach ($installer->getFeedback() as $error) {
                     $output->writeln("<error>{$error}</error>");
                 }
             }
         } else {
             $output->writeln("<info>Profile {$profileName} was already applied. Nothing happened.</info>");
         }
     }
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:53,代码来源:AddonInstallCommand.php

示例4: wikiplugin_profile

function wikiplugin_profile( $data, $params )
{
	require_once 'lib/profilelib/profilelib.php';
	require_once 'lib/profilelib/installlib.php';

	global $tiki_p_admin;

	if ( $tiki_p_admin != 'y' ) {
		return '__' . tra('Profile plugin only available to administrators') . '__';
	}

	$params = array_merge(array('domain' => 'profiles.tiki.org'), $params);

	if ( !isset( $params['name'] ) ) {
		return 'Missing parameter __name__';
	}

	$profile = Tiki_Profile::fromNames($params['domain'], $params['name']);

	if ( $profile ) {
		$installer = new Tiki_Profile_Installer;

		try {
			if ( $installer->isInstalled($profile) ) {
				if ( $_POST['reinstall'] == "{$params['domain']}/{$params['name']}" ) {
					$installer->forget($profile);
					$installer->install($profile);

					header('Location: ' . $_SERVER['REQUEST_URI']);
					exit;
				}
			} else {
				if ( $_POST['install'] == "{$params['domain']}/{$params['name']}" ) {
					$installer->install($profile);

					header('Location: ' . $_SERVER['REQUEST_URI']);
					exit;
				}
			}
		} catch( Exception $e ) {
			return '__' . $e->getMessage() . '__';
		}

		global $smarty;
		$smarty->assign('profile_is_installed', $installer->isInstalled($profile));
		$smarty->assign('profile_key', "{$params['domain']}/{$params['name']}");
		return '~np~' . $smarty->fetch('wiki-plugins/wikiplugin_profile.tpl') . '~/np~';
	} else {
		return '__' . tr('Profile %0/%1 not found', $params['domain'], $params['name']) . '__';
	}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:51,代码来源:wikiplugin_profile.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $profileName = $input->getArgument('profile');
     $repository = $input->getArgument('repository');
     $profile = \Tiki_Profile::fromNames($repository, $profileName);
     if (!$profile) {
         $output->writeln('<error>Profile not found.</error>');
         return;
     }
     $tikilib = \TikiLib::lib('tiki');
     $installer = new \Tiki_Profile_Installer();
     $isInstalled = $installer->isInstalled($profile);
     if ($isInstalled) {
         $transaction = $tikilib->begin();
         $installer->forget($profile);
         $transaction->commit();
         $output->writeln('Profile forgotten.');
     } else {
         $output->writeln('<info>Profile was not installed or did not create any objects.</info>');
     }
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:21,代码来源:ProfileForgetCommand.php

示例6: Zend_Log_Writer_Stream

include_once 'lib/core/Zend/Log/Writer/Syslog.php';
$log_level = Zend_Log::INFO;
$writer = new Zend_Log_Writer_Stream('php://output');
$writer->addFilter((int) $log_level);
$logger = new Zend_Log($writer);
$logger->debug('Running search shell utility');
require_once 'lib/profilelib/profilelib.php';
require_once 'lib/profilelib/installlib.php';
if ($_SERVER['argv'][1] === 'install') {
    $args = $_SERVER['argv'];
    $script = array_shift($args);
    $command = array_shift($args);
    $profile = array_shift($args);
    $repository = array_shift($args);
    if (!$repository) {
        $repository = 'profiles.tiki.org';
    }
    if (!$profile) {
        $logger->err('Profile not specified.');
        exit(1);
    }
    $profile = Tiki_Profile::fromNames($repository, $profile);
    if (!$profile) {
        $logger->err('Profile not found');
        exit(1);
    }
    $transaction = $tikilib->begin();
    $installer = new Tiki_Profile_Installer();
    $installer->install($profile);
    $transaction->commit();
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:31,代码来源:shell.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $addon_utilities = new \TikiAddons_Utilities();
     $addonName = $input->getArgument('addon');
     if (strpos($addonName, '/') !== false && strpos($addonName, '_') === false) {
         $package = $addonName;
         $folder = str_replace('/', '_', $addonName);
     } else {
         $package = str_replace('_', '/', $addonName);
         $folder = $addonName;
     }
     $repository = 'file://addons/' . $folder . '/profiles';
     $ignoredepends = $input->getOption('ignoredepends');
     $confirm = $input->getOption('confirm');
     if (empty(glob(TIKI_PATH . '/addons/' . $folder . '/profiles/*.yml'))) {
         $output->writeln("<error>No profiles found.</error>");
         return;
     }
     if (!$ignoredepends) {
         $addon_utilities->checkDependencies($folder);
     }
     $upgradeInfo = json_decode(file_get_contents(TIKI_PATH . '/addons/' . $folder . '/upgrade.json'));
     $validVersions = array();
     foreach ($upgradeInfo as $version => $info) {
         $validVersions[] = $version;
     }
     $config = null;
     $lastVersionInstalled = $addon_utilities->getLastVersionInstalled($folder);
     $reapplyProfiles = array();
     $forgetProfiles = array();
     $removeItems = array();
     foreach ($validVersions as $v) {
         if ($addon_utilities->checkVersionMatch($lastVersionInstalled, $v)) {
             $config = $upgradeInfo->{$v};
             $removeItems = $config->remove;
             $forgetProfiles = $config->forget;
             $reapplyProfiles = $config->reapply;
             break;
         }
     }
     $addons = \TikiAddons::getInstalled();
     if (!$config) {
         if (strnatcmp($lastVersionInstalled, $addons[$package]->version) <= 0) {
             $output->writeln("<error>Currently installed version ({$lastVersionInstalled}) is already up to date.</error>");
         } else {
             $output->writeln("<error>No valid versions currently installed to upgrade found.</error>");
         }
         return false;
     }
     $installedProfiles = $addon_utilities->getInstalledProfiles($folder);
     $installedProfileNames = array_keys($installedProfiles);
     $willRemove = false;
     foreach ($removeItems as $remove) {
         if (empty($remove->profile)) {
             $profile = '';
         } else {
             $profile = $remove->profile;
         }
         $objectId = $addon_utilities->getObjectId($folder, $remove->ref, $profile);
         $objectType = $remove->type;
         if ($objectId) {
             if ($confirm) {
                 $addon_utilities->removeObject($objectId, $objectType);
                 $output->writeln("{$objectType} '{$objectId}' has been deleted.");
             } else {
                 $output->writeln("<info>{$objectType} '{$objectId}' will be deleted.</info>");
             }
             $willRemove = true;
         }
     }
     $tikilib = \TikiLib::lib('tiki');
     $installer = new \Tiki_Profile_Installer();
     // First forget profiles that need to be forgotten
     foreach ($forgetProfiles as $toForget) {
         if (in_array($toForget, $installedProfileNames)) {
             if ($confirm || !$willRemove) {
                 $addon_utilities->forgetProfileAllVersions($folder, $toForget);
                 $profile = \Tiki_Profile::fromNames($repository, $toForget);
                 if (!$profile) {
                     $output->writeln("<error>Profile {$toForget} not found.</error>");
                 } else {
                     $installer->forget($profile);
                 }
             } else {
                 $output->writeln("<info>The installed profile {$toForget} will be forgotten.</info>");
             }
         }
     }
     if (!$confirm && $willRemove) {
         $output->writeln("<error>There will be NO undo, and all data in the above objects will be deleted as part of the upgrade.</error>");
         $output->writeln("<info>Use the --confirm option to proceed with removal and upgrade.</info>");
     }
     if ($confirm || !$willRemove) {
         // Finally install profiles
         foreach (glob(TIKI_PATH . '/addons/' . $folder . '/profiles/*.yml') as $file) {
             $profileName = str_replace('.yml', '', basename($file));
             $profile = \Tiki_Profile::fromNames($repository, $profileName);
             if (in_array($profileName, $reapplyProfiles)) {
                 $reapply = true;
             } else {
//.........这里部分代码省略.........
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:101,代码来源:AddonUpgradeCommand.php

示例8: json_encode

         }
     }
 }
 // }}}
 if (isset($_GET['refresh'])) {
     $toRefresh = (int) $_GET['refresh'];
     if (isset($sources[$toRefresh])) {
         echo json_encode(array('status' => $list->refreshCache($sources[$toRefresh]['url']) ? 'open' : 'closed', 'lastupdate' => date('Y-m-d H:i:s')));
     } else {
         echo '{}';
     }
     exit;
 }
 if (isset($_GET['getinfo'], $_GET['pd'], $_GET['pp'])) {
     $installer = new Tiki_Profile_Installer();
     $profile = Tiki_Profile::fromNames($_GET['pd'], $_GET['pp']);
     $error = '';
     // Check if profile is available.
     // This will not be the case for a misconfigured profile server
     if ($profile === false) {
         $error = "Profile is not available: " . $_GET['pd'] . ", " . $_GET['pp'];
     }
     try {
         if (!empty($error)) {
             $sequencable = false;
         } else {
             if (!($deps = $installer->getInstallOrder($profile))) {
                 $deps = $profile->getRequiredProfiles(true);
                 $deps[] = $profile;
                 $sequencable = false;
             } else {
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:31,代码来源:include_profiles.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $addon_utilities = new \TikiAddons_Utilities();
     $addonName = $input->getArgument('addon');
     if (strpos($addonName, '/') !== false && strpos($addonName, '_') === false) {
         $package = $addonName;
         $folder = str_replace('/', '_', $addonName);
     } else {
         $package = str_replace('_', '/', $addonName);
         $folder = $addonName;
     }
     $repository = 'file://addons/' . $folder . '/profiles';
     $confirm = $input->getOption('confirm');
     $uninstallInfo = json_decode(file_get_contents(TIKI_PATH . '/addons/' . $folder . '/uninstall.json'));
     $removeItems = $uninstallInfo->remove;
     $willRemove = false;
     foreach ($removeItems as $remove) {
         if (empty($remove->profile)) {
             $profile = '';
         } else {
             $profile = $remove->profile;
         }
         if (empty($remove->domain)) {
             $domain = '';
         } else {
             $domain = $remove->domain;
         }
         $objectId = $addon_utilities->getObjectId($folder, $remove->ref, $profile, $domain);
         if (is_array($objectId)) {
             $objectIds = $objectId;
         } else {
             $objectIds = [$objectId];
         }
         foreach ($objectIds as $objectId) {
             $objectType = $remove->type;
             if ($objectId) {
                 if ($confirm) {
                     $addon_utilities->removeObject($objectId, $objectType);
                     $output->writeln("{$objectType} '{$objectId}' has been deleted.");
                 } else {
                     $output->writeln("<info>{$objectType} '{$objectId}' will be deleted.</info>");
                 }
                 $willRemove = true;
             }
         }
     }
     $installedProfiles = $addon_utilities->getInstalledProfiles($folder);
     if (!$confirm && ($willRemove || !empty($installedProfiles))) {
         $output->writeln("<error>There will be NO undo, and all data in the above objects will be deleted.</error>");
         $output->writeln("<info>Use the --confirm option to proceed with removal.</info>");
     } elseif (!$willRemove) {
         $output->writeln("<info>It looks like the objects for this addon have been removed already.</info>");
     }
     if (empty($installedProfiles)) {
         $output->writeln("<info>It looks like the profiles for this addon have been removed from addon registry already.</info>");
     }
     $tikilib = \TikiLib::lib('tiki');
     $installer = new \Tiki_Profile_Installer();
     if ($confirm) {
         foreach (array_keys($installedProfiles) as $profileName) {
             $profile = \Tiki_Profile::fromNames($repository, $profileName);
             if (!$profile) {
                 $output->writeln("<error>Profile {$profileName} not found.</error>");
                 continue;
             }
             $isInstalled = $installer->isInstalled($profile);
             if ($isInstalled) {
                 $transaction = $tikilib->begin();
                 $installer->forget($profile);
                 $transaction->commit();
                 $output->writeln("Profile {$profileName} forgotten.");
             } else {
                 $output->writeln("<info>Profile {$profileName} was not installed or did not create any objects.</info>");
             }
             $addon_utilities->forgetProfileAllVersions($folder, $profileName);
             $output->writeln("Profile {$profileName} forgotten from addon registry.");
         }
     }
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:79,代码来源:AddonRemoveCommand.php


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