示例#1
0
 public static function init_dependencies(XenForo_Dependencies_Abstract $dependencies, array $data)
 {
     // initializes the core template helper object
     // in the future, we may have different template helpers for public/admin/api context
     $templateHelper = bdApi_Template_Helper_Core::getInstance();
     // register the helper methods in the format `bdApi_<method_name>`
     $templateHelperReflector = new ReflectionClass(get_class($templateHelper));
     $methods = $templateHelperReflector->getMethods();
     foreach ($methods as $method) {
         if (!($method->getModifiers() & ReflectionMethod::IS_PUBLIC) || $method->getModifiers() & ReflectionMethod::IS_STATIC) {
             // ignore restricted or static methods
             continue;
         }
         $methodName = $method->getName();
         $helperCallbackName = utf8_strtolower('api_' . $methodName);
         XenForo_Template_Helper_Core::$helperCallbacks[$helperCallbackName] = array($templateHelper, $methodName);
     }
     XenForo_CacheRebuilder_Abstract::$builders['bdApi_CacheRebuilder_ClientContentDeleteAll'] = 'bdApi_CacheRebuilder_ClientContentDeleteAll';
     bdApi_ShippableHelper_Updater::onInitDependencies($dependencies, bdApi_Option::UPDATER_URL);
 }
示例#2
0
 /**
  * Bootstraps the Updater.
  * This routine cannot be executed at `init_dependencies` due to version resolving,
  * it will run at `front_controller_pre_route` instead. This method should only be called once
  * for each <code>$config.apiUrl</code.
  *
  * @param array $config
  *
  * @internal
  */
 public static function bootstrap(array $config)
 {
     if (isset($GLOBALS[self::KEY]['setupMethod'][$config['apiUrl']])) {
         if (XenForo_Application::debugMode()) {
             die(sprintf('Updater for %s has been setup by %s already!', $config['apiUrl'], $GLOBALS[self::KEY]['setupMethod'][$config['apiUrl']]));
         }
         return;
     }
     $GLOBALS[self::KEY]['setupMethod'][$config['apiUrl']] = __METHOD__;
     if (self::$_config !== null) {
         if (XenForo_Application::debugMode()) {
             die(sprintf('%s has been setup to run with %s already!', __METHOD__, self::$_config['apiUrl']));
         }
         return;
     }
     self::$_config = $config;
     // from this point, we no longer need to care about other implementations of Updater
     // all checks have been passed and indicated that the current one is the latest version
     XenForo_CodeEvent::addListener('front_controller_pre_view', array(__CLASS__, 'front_controller_pre_view'));
 }
示例#3
0
 public static function uninstallCustomized()
 {
     $db = XenForo_Application::getDb();
     $db->query('DROP TABLE IF EXISTS `xf_bdapi_ping_queue`');
     $db->query('DELETE FROM `xf_content_type` WHERE addon_id = ?', "bdApi");
     $db->query('DELETE FROM `xf_content_type_field` WHERE content_type = ?', "api_ping");
     $db->query('DELETE FROM `xf_content_type_field` WHERE content_type = ?', "api_client_content");
     bdApi_ShippableHelper_Updater::onUninstall(bdApi_Option::UPDATER_URL);
 }