public static function init_dependencies(XenForo_Dependencies_Abstract $dependencies, array $data) { self::$dependencies = $dependencies; XenForo_Template_Helper_Core::$helperCallbacks[strtolower('WidgetFramework_snippet')] = array('WidgetFramework_Template_Helper_Core', 'snippet'); XenForo_Template_Helper_Core::$helperCallbacks[strtolower('WidgetFramework_canToggle')] = array('WidgetFramework_Template_Helper_Core', 'canToggle'); XenForo_Template_Helper_Core::$helperCallbacks[strtolower('WidgetFramework_getOption')] = array('WidgetFramework_Option', 'get'); $indexNodeId = WidgetFramework_Option::get('indexNodeId'); if ($indexNodeId > 0) { WidgetFramework_Helper_Index::setup(); } WidgetFramework_ShippableHelper_Updater::onInitDependencies($dependencies, WidgetFramework_Option::UPDATER_URL, 'widget_framework'); }
/** * 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')); }
public static function uninstallCustomized() { $db = XenForo_Application::getDb(); $db->query("DROP TABLE IF EXISTS `xf_widget`"); $db->query("DROP TABLE IF EXISTS `xf_widget_cached`"); $db->query("DELETE FROM `xf_data_registry` WHERE data_key LIKE '" . WidgetFramework_Model_Cache::CACHED_WIDGETS_BY_PCID_PREFIX . "%'"); $db->query("DELETE FROM `xf_node_type` WHERE `node_type_id` = 'WF_WidgetPage'"); $db->query("DELETE FROM `xf_node` WHERE `node_type_id` = 'WF_WidgetPage'"); XenForo_Application::setSimpleCacheData(WidgetFramework_Helper_Index::SIMPLE_CACHE_CHILD_NODES, false); XenForo_Application::setSimpleCacheData(WidgetFramework_Model_Cache::INVALIDED_CACHE_ITEM_NAME, false); XenForo_Application::setSimpleCacheData(WidgetFramework_Model_Widget::SIMPLE_CACHE_KEY, false); WidgetFramework_ShippableHelper_Updater::onUninstall(WidgetFramework_Option::UPDATER_URL, 'widget_framework'); }