getID() 공개 메소드

Returns the ID (dir name) of this plugin
public getID ( ) : string
리턴 string
예제 #1
0
파일: Locator.php 프로젝트: elgg/elgg
 /**
  * Creates new ElggUpgrade instance from plugin's static config
  *
  * @param \ElggPlugin $plugin Plugin
  * @return \ElggUpgrade[]
  */
 public function getUpgrades(\ElggPlugin $plugin)
 {
     $upgrades = [];
     $batches = $plugin->getStaticConfig('upgrades');
     if (empty($batches)) {
         // No upgrades available for this plugin
         return $upgrades;
     }
     $plugin_id = $plugin->getID();
     foreach ($batches as $class) {
         $batch = $this->getBatch($class);
         if (!$batch) {
             continue;
         }
         $version = $batch::VERSION;
         $upgrade_id = "{$plugin_id}:{$version}";
         // Database holds the information of which upgrades have been processed
         if ($this->upgradeExists($upgrade_id)) {
             $this->logger->info("Upgrade {$upgrade_id} has already been processed");
             continue;
         }
         // Create a new ElggUpgrade to represent the upgrade in the database
         $object = new ElggUpgrade();
         $object->setId($upgrade_id);
         $object->setClass($class);
         $object->title = "{$plugin_id}:upgrade:{$version}:title";
         $object->description = "{$plugin_id}:upgrade:{$version}:description";
         $object->offset = 0;
         try {
             $object->save();
             $upgrades[] = $object;
         } catch (\UnexpectedValueException $ex) {
             $this->logger->error($ex->getMessage());
         }
     }
     return $upgrades;
 }
예제 #2
0
/**
 * Cache a reference to this plugin by its ID
 *
 * @param ElggPlugin $plugin
 *
 * @access private
 */
function _elgg_cache_plugin_by_id(ElggPlugin $plugin)
{
    $map = (array) elgg_get_config('plugins_by_id_map');
    $map[$plugin->getID()] = $plugin;
    elgg_set_config('plugins_by_id_map', $map);
}
 public function testElggPluginGetID()
 {
     $test_plugin = new ElggPlugin('profile');
     $this->assertIdentical('profile', $test_plugin->getID());
 }
예제 #4
0
 public function testElggPluginGetID()
 {
     $test_plugin = new \ElggPlugin(elgg_get_plugins_path() . 'profile');
     $this->assertIdentical('profile', $test_plugin->getID());
 }