english/administrator/components/com_menus/models/item.php
/**
	 * Method rebuild the entire nested set tree.
	 *
	 * @return	boolean	False on failure or error, true otherwise.
	 * @since	1.6
	 */
Method rebuild the entire nested set tree.
@return      boolean False on failure or error, true otherwise.
Method rebuild the entire nested set tree . @return boolean False on failure or error true otherwise .
public function rebuild()
	{
		$db = $this->getDbo();
		$table = $this->getTable();
		if (!$table->rebuild()) {
			$this->setError($table->getError());
			return false;
		}
		$db->setQuery(
			'SELECT id, params' .
			' FROM #__menu' .
			' WHERE params NOT LIKE '.$db->quote('{%') .
			'  AND params <> '.$db->quote('')
		);
		$items = $db->loadObjectList();
		if ($error = $db->getErrorMsg()) {
			$this->setError($error);
			return false;
		}
		foreach ($items as &$item)
		{
			$registry = new JRegistry;
			$registry->loadString($item->params);
			$params = (string)$registry;
			$db->setQuery(
				'UPDATE #__menu' .
				' SET params = '.$db->quote($params).
				' WHERE id = '.(int) $item->id
			);
			if (!$db->query()) {
				$this->setError($error);
				return false;
			}
			unset($registry);
		}
		$this->cleanCache();
		return true;
	}
public function rebuild ( ) { $ db = $ this -> getDbo ( ) ; $ table = $ this -> getTable ( ) ; if ( ! $ table -> rebuild ( ) ) { $ this -> setError ( $ table -> getError ( ) ) ; return false ; } $ db -> setQuery ( 'SELECT id, params' . ' FROM #__menu' . ' WHERE params NOT LIKE ' . $ db -> quote ( '{%' ) . '  AND params <> ' . $ db -> quote ( '' ) ) ; $ items = $ db -> loadObjectList ( ) ; if ( $ error = $ db -> getErrorMsg ( ) ) { $ this -> setError ( $ error ) ; return false ; } foreach ( $ items as & $ item ) { $ registry = new JRegistry ; $ registry -> loadString ( $ item -> params ) ; $ params = ( string ) $ registry ; $ db -> setQuery ( 'UPDATE #__menu' . ' SET params = ' . $ db -> quote ( $ params ) . ' WHERE id = ' . ( int ) $ item -> id ) ; if ( ! $ db -> query ( ) ) { $ this -> setError ( $ error ) ; return false ; } unset ( $ registry ) ; } $ this -> cleanCache ( ) ; return true ; }
Method rebuild the entire nested set tree.
Method rebuild the entire nested set tree .
// Initialiase variables. // Convert the parameters not in JSON format. // Clean the cache