CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • menu rebuild by domain
Pages: [1]

Author Topic: menu rebuild by domain  (Read 976 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
menu rebuild by domain
April 08, 2011, 12:26:22 am
Hi,

I'm wanting to rebuild the menus on the various multisites & I'm wondering if it would be OK to make domain_id an optional variable for this function in  class CRM_Core_Menu

Code: [Select]
static function store( $truncate = true ) {
        // first clean up the db
        if ( $truncate ) {
            $query = 'TRUNCATE civicrm_menu';
            CRM_Core_DAO::executeQuery( $query );
        }
        $menuArray =& self::items( );

        self::build( $menuArray );

        require_once "CRM/Core/DAO/Menu.php";

        $config = CRM_Core_Config::singleton( );

        foreach ( $menuArray as $path => $item ) {
            $menu  = new CRM_Core_DAO_Menu( );
            $menu->path      = $path;
            $menu->domain_id = CRM_Core_Config::domainID( );

            $menu->find( true );
           
            $menu->copyValues( $item );

            foreach ( self::$_serializedElements as $element ) {
                if ( ! isset( $item[$element] ) ||
                     $item[$element] == 'null' ) {
                    $menu->$element = null;
                } else {
                    $menu->$element = serialize( $item[$element] );
                }
            }

            $menu->save( );
        }
    }
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: menu rebuild by domain
April 08, 2011, 09:35:56 am

note that we truncate the entire table in that function. So basically all the other domains will get rebuilt when someone first accesses them

you can expand that function to do so. If you do it, then you should also modify the "truncate" to delete only that domain_id menu entries

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • menu rebuild by domain

This forum was archived on 2017-11-26.