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) »
  • Anyway to trigger a menu_rebuild programably
Pages: [1]

Author Topic: Anyway to trigger a menu_rebuild programably  (Read 734 times)

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Anyway to trigger a menu_rebuild programably
July 21, 2010, 12:14:52 pm
Is there a function to call for civicrm menu_rebuild when migrating a site to another other than using cURL on http://yourdomain.com/civicrm/menu/rebuild?reset=1?

Thanks,


Chang
« Last Edit: July 21, 2010, 12:26:49 pm by xcf33 »

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: Anyway to trigger a menu_rebuild programably
July 21, 2010, 07:55:18 pm

to be on the safe side do:

CRM_Core_Config::clearDBCache
CRM_Core_Menu::build( )

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

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: Anyway to trigger a menu_rebuild programably
July 26, 2010, 11:49:57 am
I'm getting an php error telling me that

CRM_Core_Menu::build( ) is missing parameter one,

I didn't have any problem calling it before but after taking look at the code, it is passing in &$menu

Is that necessary?

My function look like this

Code: [Select]
<?php

public static function 
civicrm_config_reset() {

// @civicrm API (v2)
CRM_Core_Config::reset();
CRM_Core_Config::clearDBCache();
CRM_Core_Menu::build();
}

?>


I threw the reset() in there, don't really know if it is necessary


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: Anyway to trigger a menu_rebuild programably
July 26, 2010, 06:13:23 pm

oops, i made a mistake, you should use:

CRM_Core_Menu::store( true );

thanx

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) »
  • Anyway to trigger a menu_rebuild programably

This forum was archived on 2017-11-26.