This started out in the webmasters issue queue http://drupal.org/node/222558

Removing code from content is a good idea for many reasons, such as security, versioning, ...etc.

Attached is the first batch of these modules. All of the replace blocks, except for the bingo module which replaces the contributor links module AND several nodes that redirect to a random issue/patch.

The existing contributor_links.module that I wrote on Monday June 30 and killes installed should be disabled in favor of the bingo module.

Comments

kbahey’s picture

Assigned: Unassigned » kbahey
Status: Active » Needs review
kbahey’s picture

Note that in order to keep nodes in their existing hierarchy within the book module, some of the converted modules need the nodes to remain as nodes, but with a non-PHP format. The module will then add the output via PHP code to that node.

This is the easiest way to maintain the current way the handbook is organized but remove the code out of the nodes.

The first module to do that is the branches module. Please check the node IDs referenced in it and modify accordingly.

kbahey’s picture

StatusFileSize
new2.28 KB

Here is the second batch.

Again, look in nodeapi for the node IDs, and leave the text above the ... tag as it is, the module should append the PHP output to the node body.

kbahey’s picture

StatusFileSize
new1.59 KB

This is the third part.

Same comments apply for the nodeapi hook.

The searchquery page caches results every one hour, per Kieran's request.

kbahey’s picture

StatusFileSize
new1.65 KB

This is the fourth and last set of refactoring.

There is a list of nodes that either have no PHP in them, but they have the PHP format assigned so they cannot be changed by the doc team. There are other nodes that have some issues, and hence are not refactored.

Here is a comprehensive list of all the PHP nodes with issues in them.

22106: Uses the path admin/node, which is an obsolete path in D5
185363: not sure if this is needed. Seems like some old test code?
191407: Of what use is this node, select all profile values? Why? Seems a one off node for reporting.
312: Why would it have the help in there? Seems silly.

21945: Principles. No PHP code.
176817: Ditto (no PHP)
1025: Ditto (no PHP)
13236: Ditto (no PHP)

The following 3 are some old MySQL nodes. Not sure if they are used or not. Probably best to not use any of them either way.

47905: mysql table schema for d.o slow queries
47909: mysql explain for slow queries
59791: mysql test page (contains the dbtuning module from here http://drupal.org/cvs?commit=32115)

Finally

102003: This is used to unpublish project releases. This needs to be made into a proper module with proper role access to do this recurring task.

killes@www.drop.org’s picture

The code is now on drupal.org.

I made two minor changes:

- use l() in the planet module

- fix the contributor's block by adding "return $output;"

Not all blocks may be correctly configured, leaving open until this has happened.

Thanks Khalid!

kbahey’s picture

@killes, can you add the code to the drupalorg project, so I can work on it from CVS?

Meanwhile, did you change the PHP nodes to change the filter and remove the php code?

kbahey’s picture

StatusFileSize
new698 bytes

As per discussion on the mailing list, here is a module that allows execution of PHP for users with the appropriate role permissions. Kieran and Gabor are happy with this approach.

kbahey’s picture

Once this is live, the PHP filter can be deleted from drupal.org.

kbahey’s picture

Status: Needs review » Fixed

This commit http://drupal.org/cvs?commit=124772 closes this issue.

gerhard killesreiter’s picture

22106: deleted
185363: deleted
191407: deleted
312: changed to docs input format and entrusted to the docs team.

47905: deleted
47909: deleted
59791: deleted

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

gerhard killesreiter’s picture

Status: Closed (fixed) » Active

Sadly, I've to reopen this.

There are still blocks that use PHP for their visibility settings.

http://drupal.org/admin/build/block/configure/advert/0

http://drupal.org/admin/build/block/configure/block/7

gerhard killesreiter’s picture

There'S actually a thried block, here's the code that they use

return (arg(0) == 'node' 
      && is_numeric(arg(1))
      && ($node = node_load(array('nid' => arg(1))))
      && $node->type == 'book');
// Note: Change this line to switch which forum this block appears in.
$forum_id = 34;

if (arg(0) == 'forum' && arg(1) == $forum_id) {
  return TRUE;
}
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $node = node_load(arg(1));
  if ($node->type == 'forum' && $node->tid == $forum_id) {
    return TRUE;
  }
}
return FALSE;
if (arg(0) == 'node') return TRUE;
if (arg(0) == 'forum') return TRUE;
return FALSE;
drumm’s picture

Status: Active » Closed (fixed)

I believe this was fixed at some point.