how to disable extension when cannot access to the board

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
BF79
Registered User
Posts: 522
Joined: Fri Feb 13, 2015 1:28 pm
Name: Fouad B

how to disable extension when cannot access to the board

Post by BF79 »

hello gurys ..I just started to build new forum.. 3.3.13
I lost access when I installed one ext..
I tried this script but doesnt work for me
:(
need help thx

Code: Select all

<?php
/***
*
* Usage: Download and unzip the file, upload it to your Board's root (i.e.: www.mydomain.com/phpBB3/)
* Point your browser to i.e.: www.mydomain.com/phpBB3/ext_disable.php) and follow instructions.
*
* Version 1.0.0 - david63 2017
* Based on modisson.php - Oyabun1 2015
*
* This script is free software. It comes without any warranty.
* license http://opensource.org/licenses/GPL-2.0 GNU General Public License v2.
*
* Ensure that you have a backup of your Database before to run this tool
*
*/

define('IN_PHPBB', true);

$phpbb_root_path	= (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx 				= substr(strrchr(__FILE__, '.'), 1);

// Change this to 'false' if you do not want to delete this file
$remove_me = true;

include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include_once($phpbb_root_path . 'phpbb/extension/manager.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);

/* If ANONYMOUS = login box */
if ((int) $user->data['user_id'] == ANONYMOUS)
{
	login_box(request_var('redirect', "ext_disable.$phpEx"));
}

// Limit this to founders or admins
if ((int) $user->data['user_type'] !== USER_FOUNDER || !$auth->acl_get('a_'))
{
	trigger_error('You do not have permission to alter the database.
	You need to be logged in as a founder or administrator.');
}

// Let's see how many extension we can disable
$orig_ext_count = get_active_ext();

// Create a HTML5 page to add some form elements and display stuff
echo '<!DOCTYPE html>';
echo '<html>';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
echo '<title>' . basename(__FILE__) . '</title>';

echo '<style type="text/css">
	body {
		font-size: 1em;
		background-color: #C0C0C0 ;
		width: 600px;
		margin: 2em auto 0;
	}

	form {
		text-align: center;
		line-height: 230%;
	}

	fieldset {
		-moz-border-radius:7px;
		border-radius: 7px;
		-webkit-border-radius: 7px;
	}

	h3 {
		text-align: center;
	}

	label {
		cursor: pointer;
		background-color: #FFD700;
		border-style: outset;
		border-width; 1px;
		border-radius: 7px;
		border-color: #808080;
		font-size: 1.1em;
		padding: 2px;
		margin: 2px;
	}

	input[type="checkbox"]:disabled {
    	opacity:0;
	}

	input[type="checkbox"] {
		cursor: pointer;
	}

	img.mid {
		display: block;
		margin-top: 1em;
		margin-left: auto;
		margin-right: auto
	}

	/* Buttons based on Pressable CSS Buttons by Joshua Hibbert */
	.button {
		background-image: -webkit-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
		background-image:    -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
		background-image:     -ms-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
		background-image:      -o-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
		background-image:         linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
		border: none;
		border-radius: 1.25em;
		box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
					inset 0 2px 0 hsla(0,0%,100%,.1),
					inset 0 1.2em 0 hsla(0,0%,100%,.05),
					inset 0 -.2em 0 hsla(0,0%,100%,.1),
					inset 0 -.25em 0 hsla(0,0%,0%,.5),
					0 .25em .25em hsla(0,0%,0%,.1);
		color: #fff;
		text-shadow: 0 -1px 1px hsla(0,0%,0%,.25);
		cursor: pointer;
		display: inline-block;
		font-family: sans-serif;
		font-size: 1.1em;
		font-weight: bold;
		line-height: 150%;
		margin: 0 .5em;
		padding: .25em .75em .5em;
		position: relative;
		text-decoration: none;
		vertical-align: middle;
	}

	.button:hover {
		outline: none;
	}

	.button:hover, .button:focus {
		box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
					inset 0 2px 0 hsla(0,0%,100%,.1),
					inset 0 1.2em 0 hsla(0,0%,100%,.05),
					inset 0 -.2em 0 hsla(0,0%,100%,.1),
					inset 0 -.25em 0 hsla(0,0%,0%,.5),
					inset 0 0 0 3em hsla(0,0%,100%,.2),
					0 .25em .25em hsla(0,0%,0%,.1);
	}

	.button:active {
		box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
					inset 0 2px 0 hsla(0,0%,100%,.1),
					inset 0 1.2em 0 hsla(0,0%,100%,.05),
					inset 0 0 0 3em hsla(0,0%,100%,.2),
					inset 0 .25em .5em hsla(0,0%,0%,.05),
					0 -1px 1px hsla(0,0%,0%,.1),
					0 1px 1px hsla(0,0%,100%,.25);
		margin-top: .25em;
		outline: none;
		padding-bottom: .5em;
	}

	.green {
		background-color: #228B22;
	}

	.remove_me {
		color: #FFFFFF;
		width: 560px;
		margin: 2em auto 0;
		padding: .5em;
		font-size: 1.1em;
		background-color: #8B0000;
	}

</style>';

echo '</head>';
echo '<body>';

// Create a form with a checkbox
echo '<h3>Disable all extensions</h3>';
echo '<fieldset><legend><strong>Check the selection box and click the Run button.</strong></legend>';
echo '<form action="' . basename(__FILE__) . '" method="post" onsubmit="return confirm(\'You are about to disable ' . $orig_ext_count . ' extensions. \n Make sure you first have a database backup. \n If you click OK there is no going back.\')">';
echo '<label title="Disable '. $orig_ext_count . ' extensions"><input type="checkbox" name="chkExt"
	value="Yes" />Disable '. $orig_ext_count . ' extensions&nbsp;</label>&nbsp;';
echo '<p><button type="submit" class="button green";>Run</button></p>';
echo '</form>';
echo '</fieldset><br>';
echo '<fieldset style="background-color:#F5FCFF; border-color:#00CC00; border-style: solid;"><legend>
		<strong>Result</strong></legend>';

// Use request_var() to get the returned value of the selection
$chk_ext = (request_var('chkExt', ''));

// Get the current version from 'includes/constants.php'
$version = PHPBB_VERSION;

// Let's make sure that we are running phpBB > 3.1
if (phpbb_version_compare($version, '3.1.0', '>='))
{
	// Disable extensions
	if($chk_ext == 'Yes')
	{
		// Get the enabled extensions
		$sql = 'SELECT ext_name
			FROM ' . EXT_TABLE . '
			WHERE ext_active = 1';

		$result = $db->sql_query($sql);

		// Now we can try to disable the extensions
		if (!empty($result))
		{
			while ($ext_name = $db->sql_fetchrow($result))
			{
				while ($phpbb_extension_manager->disable_step($ext_name['ext_name']));
			}

			$db->sql_freeresult($result);
		}
		else
		{
			echo 'No extensions found to disable';

			remove_me();
		}

		// Get count of extensions disabled
		$disabled_ext = $orig_ext_count - get_active_ext();

		// Add disable action to the admin log
		add_log('admin', $disabled_ext . ' extensions disabled');

		echo $disabled_ext . ' extensions have been disabled.';

		remove_me();
	}
}
else
{
	// User has an invalid version of phpBB
	echo 'This script can only be run on versions of phpBB greater than 3.1.0<br />Your version of phpBB: /includes/constants.php ' . $version .'<br>Since the version is invalid no extensions are able to be disabled.<br>';

	remove_me();
}

echo '</form>';
echo '</fieldset>';
echo '</body>';
echo '</html>';


// Get count of active extensions
function get_active_ext()
{
	global $db;

	$sql = 'SELECT COUNT(ext_active) AS active_ext
		FROM ' . EXT_TABLE . '
		WHERE ext_active = 1';

	$result		= $db->sql_query($sql);
	$ext_count	= (int)$db->sql_fetchfield('active_ext');

	$db->sql_freeresult($result);

	return $ext_count;
}

// Try to delete this file
function remove_me()
{
	if ($remove_me)
	{
		@unlink(__FILE__);

		// Windows IIS servers may have a problem with unlinking recently created files.
		// So check if file exists and give a message
		if (file_exists(__FILE__))
		{
			echo '<p class="remove_me">File could not be deleted. You will need to manually delete the ' . basename(__FILE__) . ' file from the server.</p>';
		}
	}
}
Last edited by Mick on Wed Sep 18, 2024 6:33 am, edited 1 time in total.
Reason: Solved.
User avatar
Madalin10
Registered User
Posts: 102
Joined: Wed Jun 18, 2014 2:42 pm
Name: Madalin C.

Re: how to disable extension when cannot access to the board

Post by Madalin10 »

I think the script is working, but you have to delete the cache. You can delete it by using ftp, and going in the board's root and you should have a folder "cache" open it and delete the folder "production".

I've tested it, but I had to purge cache/delete it as I said above to take the effect.
https://awesome-web.design - I offer phpBB & web design services at fair prices.
BF79
Registered User
Posts: 522
Joined: Fri Feb 13, 2015 1:28 pm
Name: Fouad B

Re: how to disable extension when cannot access to the board

Post by BF79 »

Madalin10 wrote: Mon Sep 16, 2024 9:37 pm I think the script is working, but you have to delete the cache. You can delete it by using ftp, and going in the board's root and you should have a folder "cache" open it and delete the folder "production".

I've tested it, but I had to purge cache/delete it as I said above to take the effect.
tried... nothing :(
User avatar
SpIdErPiGgY
Registered User
Posts: 270
Joined: Sun May 02, 2021 2:11 pm
Location: Erpe-Mere, Aalst, BE
Name: Andy Dm

Re: how to disable extension when cannot access to the board

Post by SpIdErPiGgY »

In the database, I think the phpbb_ext table
Search there for the extension and set the value from 1 to 0

Then via ftp, delete everything in the /cahe folder
phpBB NL Extension translations, also on request.
--> Click Here: Myarea51secrets.com <--
User avatar
P_I
Community Team Member
Community Team Member
Posts: 2437
Joined: Tue Mar 01, 2011 8:35 pm
Location: Western Canada 🇨🇦

Re: how to disable extension when cannot access to the board

Post by P_I »

The OP could review the various methods in Knowledge Base - Disabling all extensions at once?
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
BF79
Registered User
Posts: 522
Joined: Fri Feb 13, 2015 1:28 pm
Name: Fouad B

Re: how to disable extension when cannot access to the board

Post by BF79 »

SpIdErPiGgY wrote: Mon Sep 16, 2024 10:24 pm In the database, I think the phpbb_ext table
Search there for the extension and set the value from 1 to 0

Then via ftp, delete everything in the /cahe folder
not sure where I do search !!
User avatar
Madalin10
Registered User
Posts: 102
Joined: Wed Jun 18, 2014 2:42 pm
Name: Madalin C.

Re: how to disable extension when cannot access to the board

Post by Madalin10 »

BF79 wrote: Mon Sep 16, 2024 10:47 pm
SpIdErPiGgY wrote: Mon Sep 16, 2024 10:24 pm In the database, I think the phpbb_ext table
Search there for the extension and set the value from 1 to 0

Then via ftp, delete everything in the /cahe folder
not sure where I do search !!
First you have to see the name of your database, I assume you don’t know it. So from ftp, board’s root folder (where all files/folders of your board are) scroll down a little bit until you see a file named “config.php” just open it and look at the line “dbname”, and you going to see your database name.

Then open phpmyadmin and select your database name, and you will see a list with all tables in it and if you scroll down a little bit, there will be the table “phpbb_ext”. Note: the default prefix is “phpbb_” if you changed the prefix during the installation of your board, then it will use that prefix instead. Example: “myawesomedb_ext”

Image

After you found the table phpbb_ext click on it once on the name, or in the right side on the”browse” like in my image.
It will display every extension that you have on your board.

Image

Click on edit and you should have something like this page:

Image

Look for the “ext_active” and on the right side on the same line, where you see 1 change it to 0 and then a little down below you will have a button “go/submit” press on it that’s it.

You will have to do this process for every extension that you have there. Note if some of them are already on 0 you don’t need to do anything.

After you change them to 0, delete the production folder from the cache folder via ftp.
https://awesome-web.design - I offer phpBB & web design services at fair prices.
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26828
Joined: Fri Aug 29, 2008 9:49 am

Re: how to disable extension when cannot access to the board

Post by Mick »

All the information you need is within the KB article.
  • "The more connected we get the more alone we become” - Kyle Broflovski© 🇬🇧
BF79
Registered User
Posts: 522
Joined: Fri Feb 13, 2015 1:28 pm
Name: Fouad B

Re: how to disable extension when cannot access to the board

Post by BF79 »

Madalin10 wrote: Tue Sep 17, 2024 9:06 am
thank you bro for tuto..
done :)
Last edited by Mick on Wed Sep 18, 2024 6:32 am, edited 1 time in total.
Reason: Removed unnecessary full quotes.

Return to “[3.3.x] Support Forum”