MyBB Community Forums
Script to Update Plugins for 1.6.5 - Printable Version

+- MyBB Community Forums (
+-- Forum: Community Archive (
+--- Forum: Archived Forums (
+---- Forum: Archived Development and Support (
+----- Forum: MyBB 1.6 (
+------ Forum: 1.6 General Support (
+------ Thread: Script to Update Plugins for 1.6.5 (/thread-108595.html)

Pages: 1 2 3 4 5 6 7 8 9 10

Script to Update Plugins for 1.6.5 - pavemen - 2011-11-28

I've updated my original script ( to actually update the plugin files now. All the fixes use the "reference" method by adding "&" where needed.


Where needed = function called by affected hook and no "&" already present

So I suggest that you backup your ENTIRE plugins folder and any subfolders.

Remove any old version of my original script from the plugins folder

Download the attached file to your local computer, open it in a text editor and make sure that $dryrun is set to 1 and the $plugin_dir is correct

Save and upload the file to your forum root (where index.php and showthread.php are located)

Direct your browser to the newly uploaded file and it will output all the hooks its looking for in each directory (plugins and subfolders), each file, each function/hook then all the files that will actually be changed and how many fixes in each will be applied

If it all looks okay, edit your local copy and change $dryrun to 0, save and upload.

Reload the browser page and wait for the done message. All changed files will be listed.

Run it again and there should be no changed files listed, indicating the files were updated the first pass.

Feedback accepted, please use at your risk, but it seems to be working on my server.

If the plugin author has already updated his/her plugin, I suggest that you use that version instead.

Update: 11/30/11: This script was updated to cover the case where inline comments are given directly after the add_hooks calls in the plugin file.

RE: script to update plugins for 1.6.5 - andrewjs18 - 2011-11-28

thanks for writing this, pavemen!

RE: script to update plugins for 1.6.5 - seeker - 2011-11-28

This is great, thanks pavemen.

RE: script to update plugins for 1.6.5 - crazy4cs - 2011-11-28

Very nice, I hope it could work out with all. I'd test this one today. Also, it'd be great if this thread is sticky so as many threads pointing out how could I update will look into this. Smile

RE: script to update plugins for 1.6.5 - - 2011-11-28

WoW! Very nice script.

RE: script to update plugins for 1.6.5 - Jayfore - 2011-11-28

Whoah! Very cool -- thank you!

RE: Script to Update Plugins for 1.6.5 - mohdows - 2011-11-28

cool Smile

RE: Script to Update Plugins for 1.6.5 - crazy4cs - 2011-11-28

Sticked, nice, this could help many who searches out for updating the plugins on their own. Smile

RE: Script to Update Plugins for 1.6.5 - BeeJayZZR - 2011-11-28

Thanks a lot for this very useful script. Great Job!

RE: Script to Update Plugins for 1.6.5 - Diogo Parrinha - 2011-11-29

Someone PM'd me that this script was saying that MyAdvertisements required to be updated but MyAdvertisements always used receiving by reference. Either your script is failing somewhere or something else is happening.

Oh and this was the function it mentioned:
function myadvertisements_postbit_disable(&$post)
	global $mybb, $templates;
	$cachetemps = array();
		$cachetemps[] = 'postbit';
		$cachetemps[] = 'postbit_classic';
	if (!empty($cachetemps))
		$templates->cache(implode(',', $cachetemps));
	if (!isset($mypostcounter))
		$mypostcounter = 0;
	static $postbit_backup = '';
	static $postbit_classic_backup = '';
	// Fix purposed by Yumi/Zinga
    static $restore_postbit = null;
    if (empty($postbit_backup) || $restore_postbit)
        $viewmode = ($mybb->settings['postlayout'] == 'classic' ? '_classic' : '');
        $restore_postbit = (
            && isset($templates->cache['postbit_first'.$viewmode])
            && $templates->cache['postbit_first'.$viewmode] == $templates->cache['postbit'.$viewmode]
        $postbit_backup = $templates->cache['postbit'];
        $postbit_classic_backup = $templates->cache['postbit_classic'];
	$templates->cache['postbit'] = str_replace('{myadvertisements[zone_3]}', '', $postbit_backup);
	$templates->cache['postbit_classic'] = str_replace('{myadvertisements[zone_3]}', '', $postbit_classic_backup);