Jump to content

Upgrade from 2.5.24 to 2.5.25 broke the site


Juergen
 Share

Recommended Posts

After upgrade I got the following error:

Compile Error: Cannot redeclare PageEditFieldPermissionConfig() (previously declared in 
/home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php:8) (line 69 of 
/home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php)
This error message was shown because you are logged in as a Superuser. Error has been logged. 

I upgraded wire and index.php not the htaccess file.

At the moment I changed it back to 2.5.24 to get it working.

Does anyone struggle with the same problem?

Link to comment
Share on other sites

The Question is why do you have two classes with the same name: "PageEditFieldPermissionConfig"?

One in the sites module directory and now there seems to be one in the core too? Can you have a look to this?

Ah, I have edited your error and wrapped it into different lines, Now we can read it better:

It isn't about two classes, it seems to have two methods with the same name:

Compile Error: Cannot redeclare PageEditFieldPermissionConfig() (previously declared in 
/home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php:8) (line 69 of 
/home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php)

Please have a look into site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php at line 8 and at line 69, it seems that those lines both want to declare a method (or class) with the same name: PageEditFieldPermissionConfig.

Edited by horst
Link to comment
Share on other sites

Hello Horst,

I have looked into that before I have posted this topic, but I couldnt find the reason on line 8 and 69.

<?php

/**
 * Provides the implementation for the PageEditFieldPermission::getModuleConfigInputfields method
 *
 */

function PageEditFieldPermissionConfig(array $data) {

	$inputfields = new InputfieldWrapper();

	$f = wire('modules')->get('InputfieldMarkup');
	$f->label = 'How to use this module';
	$f->attr('name', '_instructions');
	$config = wire('config');
	$f->value = <<< _OUT

	<p>
	To use, create a <a href='{$config->urls->admin}access/permissions/'>new permission</a> 
	and name it <b>page-edit-[field]</b>, replacing [field] with the name of the field you 
	want to limit access to. <em>Better yet, use the tool below to create them for you and save some time.</em>
	</p>

	<p> 
	Once your page-edit-[field] permission(s) exist, <a href='{$config->urls->admin}access/roles/'>add them to any roles</a> 
	that you want to have edit access to the field. Roles that have edit access to a page, but do not have the 
	required page-edit-[field] permission will not be able to see or modify the [field] in the page editor. 
	</p>

	<p>Note that none of this applies to users with the superuser role, as they always have access to edit everything.</p>

_OUT;

	$createPermissions = wire('input')->post->_create_permissions;
	if($createPermissions) foreach($createPermissions as $name) {
		$name = wire('sanitizer')->pageName($name);
		$permission = wire('permissions')->add("page-edit-$name");
		$permission->title = "Access to edit the '$name' field"; 
		$permission->save();
		wire('modules')->message("Added permission: $permission->name");
	}

	$inputfields->add($f);

	$f = wire('modules')->get('InputfieldCheckboxes');
	$f->attr('name', '_create_permissions'); 
	$f->label = 'Handy tool to create permissions for you';
	$f->optionColumns = 3; 
	$f->description = 'Check the box next to each field name you would like this tool to create a permission for you. This is the same thing as going to the Permissions page and creating them yourself, so this is here primarily as a time saver.';
	$fields = array('name', 'parent', 'template', 'status'); 
	$notes = '';
	foreach(wire('fields') as $field) $fields[] = $field->name; 
	foreach($fields as $name) {
		if($name == 'pass') continue; 
		if(wire('permissions')->get("page-edit-$name")->id) {
			$notes .= "$name, ";
			continue; 
		}
		$f->addOption($name);
	}
	if(!$notes) $notes = "[none yet]";
	$f->notes = 
		"Fields that already have permissions: " . rtrim($notes, ", ") . ". " . 
		"Non-superuser roles that have page-edit access will no longer be able to see/edit these fields unless the appropriate permission is assigned to that role. ";
	$inputfields->add($f);

	return $inputfields;

}

Line 8 is function PageEditFieldPermissionConfig(array $data) {

and line 69 is the closing bracket at the end

Link to comment
Share on other sites

After uninstalling the PageEditPermission module the upgrade works as expected. I made the update and after that I reinstall the module once more. The error appear once more.

I dont need this module at the moment, but this module causes the error. So it seems that it is not compatible with the latest version at the moment

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...