function category_tree($leaf = false, $level = 1) { if (!$leaf) { $leaf = MsCategoryFactory::get_root_category(); } $indent = str_repeat('#', $level); $name = $leaf->get('name'); if (!$name) { $name = "''no name set!''"; } $id = $leaf->id; $r = "{$indent} '''[[MediaWiki:ms-{$id}-category|{$id}]]''' " . ($leaf->exists() ? '' : "'''DOES NOT EXIST'''") . "\n"; $r .= "{$indent}* ''MSGS'': [[MediaWiki:ms-{$id}-record|record]], [[MediaWiki:ms-{$id}-category-input|input]], [[MediaWiki:ms-{$id}-presearch-box|presearch]], [[MediaWiki:ms-{$id}-postsearch-box|postsearch]]\n"; $r .= "{$indent}* ''DATABASES'': "; foreach ($leaf->get_databases() as $db) { $r .= "[[MediaWiki:ms-{$db}-database|{$db}]], "; $msg = MsDatabase::get_conf_msg_name($db); if (wfMsgExists($msg)) { $this->list_of_msgs[] = $msg; } } $r .= "\n"; foreach ($leaf->get_conf_array() as $k => $v) { $r .= "{$indent}* ''{$k}'': {$v}\n"; } #if(wfMsgExists($msg)) $this->list_of_msgs += $msg; $this->list_of_msgs = array_merge($this->list_of_msgs, $leaf->get_messages()); $this->list_of_dbs = array_merge($this->list_of_dbs, $leaf->get_databases()); foreach ($leaf->get_sub_categories(MsCategory::AS_OBJECTS) as $subcat) { $r .= $this->category_tree($subcat, $level + 1); } return $r; }
public function get_messages() { $possible_msgs = array('Ms-$1-category', 'Ms-$1-record', 'Ms-$1-presearch-box', 'Ms-$1-postsearch-box'); $existing_msgs = array(); foreach ($possible_msgs as $msg) { $msg = str_replace('$1', $this->id, $msg); if (wfMsgExists($msg)) { $existing_msgs[] = $msg; } } return $existing_msgs; }
public function has_configuration($message = false) { if (!$message) { if ($this->conf_msg) { $message = $this->conf_msg; } else { throw new MsException("MsMsgConfiguration: Missing message param (<b>{$message}</b>)"); } } return wfMsgExists($message); }
public static function is_installed($id) { return file_exists(self::get_driver_filename($id)) || wfMsgExists(self::get_conf_msg_name($id)); }