MyBB Community Forums

Full Version: Script to Update Plugins for 1.6.5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10
(2011-11-29, 10:13 PM)Pirata Nervo Wrote: [ -> ]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();
	
	if(!$templates->cache['postbit'])
		$cachetemps[] = 'postbit';
		
	if(!$templates->cache['postbit_classic'])
		$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
	// http://mybbhacks.zingaburga.com/showthread.php?tid=572&pid=5133#pid5133
    static $restore_postbit = null;
    if (empty($postbit_backup) || $restore_postbit)
    {
        $viewmode = ($mybb->settings['postlayout'] == 'classic' ? '_classic' : '');
        $restore_postbit = (
            !isset($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);
}


they may be using the old version that only indicated that a plugin uses one of the hooks listed as effected by the 1.6.5 changes and lists the filename, hook name and function name referenced by the hook. It was not smart enough to know if the fix was actually needed. That was explained several times in the original thread. The person that contacted you did not read the whole original thread.

This new version actually checks if the "&" is there already and updates the local file if it is not.
(2011-11-29, 10:19 PM)pavemen Wrote: [ -> ]
(2011-11-29, 10:13 PM)Pirata Nervo Wrote: [ -> ]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();
	
	if(!$templates->cache['postbit'])
		$cachetemps[] = 'postbit';
		
	if(!$templates->cache['postbit_classic'])
		$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
	// http://mybbhacks.zingaburga.com/showthread.php?tid=572&pid=5133#pid5133
    static $restore_postbit = null;
    if (empty($postbit_backup) || $restore_postbit)
    {
        $viewmode = ($mybb->settings['postlayout'] == 'classic' ? '_classic' : '');
        $restore_postbit = (
            !isset($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);
}


they may be using the old version that only indicated that a plugin uses one of the hooks listed as effected by the 1.6.5 changes and lists the filename, hook name and function name referenced by the hook. It was not smart enough to know if the fix was actually needed. That was explained several times in the original thread. The person that contacted you did not read the whole original thread.

This new version actually checks if the "&" is there already and updates the local file if it is not.

Ah I should have supposed that. People don't read entire threads these days.
(2011-11-29, 10:22 PM)Pirata Nervo Wrote: [ -> ]Ah I should have supposed that. People don't read entire threads these days.

This is why the original thread is locked. I should really edit the first post though and post pavemen's script there.

If thats OK with you Pave?
the original post (http://community.mybb.com/thread-106729-...#pid777848) has been tweaked by Paul already and the attachment in this thread is correct/current
but, yes, if you want to add a link to this thread in Dylan's original thread on this subject, feel free. The more visible this solution is, the fewer support requests (hopefully)
(2011-11-30, 12:50 AM)pavemen Wrote: [ -> ]the original post (http://community.mybb.com/thread-106729-...#pid777848) has been tweaked by Paul already and the attachment in this thread is correct/current
but, yes, if you want to add a link to this thread in Dylan's original thread on this subject, feel free. The more visible this solution is, the fewer support requests (hopefully)

I used the script and it was quick and easy! Just follow Pave's directions above! no problems!!
work great!

[Image: hookupdate.jpg]

Thanks pave

/edit.

After using this hookupdate , i found that some of the plugins not work.
For example tagging plugin ( http://mods.mybb.com/view/tagging-plugin ) doesnt appear in plugins configuration menu. I check that the hook plugins remove the script in inc/plugins/tagging.php .

So , i download the new one , open it in WorPad , using find function ( ctrl + F ) to find function script. After that simply add the & before $

for example :

function tagging_get_user($p)

simply add & to make it like this

function tagging_get_user(&$p)

read at first post of pave , u will know how to do this.

tagging plugins that i have update can be found here : http://pastebin.com/ptTV1Yk5

Thanks for all.
Thanks for the script pavemen it helped me upgrading my plugins.

+ Rep
(2011-11-30, 12:50 AM)pavemen Wrote: [ -> ]the original post (http://community.mybb.com/thread-106729-...#pid777848) has been tweaked by Paul already and the attachment in this thread is correct/current
but, yes, if you want to add a link to this thread in Dylan's original thread on this subject, feel free. The more visible this solution is, the fewer support requests (hopefully)

Done
http://community.mybb.com/thread-106729.html
(2011-11-30, 10:44 AM)fakhrul Wrote: [ -> ]work great!

[Image: hookupdate.jpg]

Thanks pave

/edit.

After using this hookupdate , i found that some of the plugins not work.
For example tagging plugin ( http://mods.mybb.com/view/tagging-plugin ) doesnt appear in plugins configuration menu. I check that the hook plugins remove the script in inc/plugins/tagging.php .

So , i download the new one , open it in WorPad , using find function ( ctrl + F ) to find function script. After that simply add the & before $

for example :

function tagging_get_user($p)

simply add & to make it like this

function tagging_get_user(&$p)

read at first post of pave , u will know how to do this.

tagging plugins that i have update can be found here : http://pastebin.com/ptTV1Yk5

Thanks for all.

You don't need to add the "&" everytime there is a "$" in a function call.

I fixed the script to deal with what was causing the problem with this plugin, it was not dealing with inline comments to the add_hooks lines when searching for the functions to modify. This is what was breaking the plugin after the update.

The new script is attached to the first post, sorry for the problem
(2011-11-30, 05:06 PM)pavemen Wrote: [ -> ]You don't need to add the "&" everytime there is a "$" in a function call.

I fixed the script to deal with what was causing the problem with this plugin, it was not dealing with inline comments to the add_hooks lines when searching for the functions to modify. This is what was breaking the plugin after the update.

The new script is attached to the first post, sorry for the problem

thats why after update the script dissapear. Thanks again pave .
Pages: 1 2 3 4 5 6 7 8 9 10