split mode

chx - October 29, 2005 - 11:20
Project:Drupal
Version:7.x-dev
Component:base system
Category:feature request
Priority:normal
Assigned:chx
Status:duplicate
Description

The attached script loads all includes and modules and writes every functon into its own include file. The patch that will follow teaches Drupal how to work in split mode. To engage split mode at this moment you need to add 'split_mode' => 1 to $conf.

AttachmentSizeStatusTest resultOperations
split.php5.68 KBIgnoredNoneNone

#1

chx - October 29, 2005 - 11:25

Here is the patch. I really worked hard on change as little as possible. Because it is possible that split.php will be sentenced to contrib for Drupal 4.7 cycle, and that's fine but core should be ready for it.

AttachmentSizeStatusTest resultOperations
split.patch8.19 KBIgnoredNoneNone

#2

chx - October 29, 2005 - 14:43

New, even smaller patch. Script follows.

AttachmentSizeStatusTest resultOperations
split_0.patch7.35 KBIgnoredNoneNone

#3

chx - October 29, 2005 - 14:44

Of course, the script got a bit bigger...

AttachmentSizeStatusTest resultOperations
split_0.php6.24 KBIgnoredNoneNone

#4

chx - October 29, 2005 - 15:04

With .txt extension.

If you read the code, you'll see I do a strange dance with module.inc because I load all if its functions anyways, so why split? This way the function_exists in module_hook gets rewritten to drupal_function_exists but only in split module. So, drupal_function_exists is a) moved to split.inc b) need not to check for split_mode all the time.

AttachmentSizeStatusTest resultOperations
split.php.txt6.4 KBIgnoredNoneNone

#5

chx - October 29, 2005 - 17:37

Another run... drupal_get_title was a tough one. But the solution is, IMO, quite elegant.

AttachmentSizeStatusTest resultOperations
split_1.patch8.41 KBIgnoredNoneNone

#6

chx - October 29, 2005 - 17:38
AttachmentSizeStatusTest resultOperations
split.php_0.txt6.43 KBIgnoredNoneNone

#7

chx - October 29, 2005 - 18:58

Modified further drupal_bootstrap so it's simpler now but still returns the remaining phases. Allowed me to remove a few bytes from index.php, so it's again under 700 bytes. Note: the comments in index.php is not up to par anymore.

AttachmentSizeStatusTest resultOperations
split_2.patch8.98 KBIgnoredNoneNone

#8

chx - October 29, 2005 - 23:18

Back to #5 -- the patch in #7 is bogus. Better docs though.

AttachmentSizeStatusTest resultOperations
split_3.patch8.43 KBIgnoredNoneNone

#9

asimmonds - October 30, 2005 - 08:47

Is this against 4.6.3 or HEAD?, as the issue version says 4.6.3 but the patches are for HEAD.

Anyways, in trying it against HEAD, patch #8 applies and split.php #6 executes OK.

Came across 3 problems so far:
- In admin/logs, admin/path and admin/user I get: Warning: preg_replace_callback() requires argument 2, '_unicode_caseflip', to be a valid callback in \files\split\dr\drupal_strtoupper.inc on line 8

- In admin/filters/add I get: Warning: uasort(): Invalid comparison function. in \files\split\fi\filter_list_all.inc
(I think some of the split functions are not finding they callbacks)

- Apache PHP module crashes when I try to create content eg node/add/page. I don't get a entry in apache's error.log, but the last file read before the crash is: \files\split\me\menu_parent_options.inc

Everything else I tried seemed to work OK, haven't looked at the code yet.

Test enviroment is: Apache 1.3.33/PHP 4.4.0 under windows with current HEAD

#10

chx - October 30, 2005 - 10:12
Version:4.6.3» x.y.z

Of course it's against HEAD. Thanks for review. Please try ab. I added the two mentioned functions to exceptions in split.php. I will inspect the node add problem.

AttachmentSizeStatusTest resultOperations
split.php_1.txt6.47 KBIgnoredNoneNone

#11

Gábor Hojtsy - November 1, 2005 - 12:09

Looking at pacth #8 (not trying it, just examining the diff), my only suspicious part is the system module change. Why does that add a function_exists(), while all other parts remove these and add module_exists() and module_invoke()?

#12

chx - November 1, 2005 - 12:24

I think you mean remove module_* The module_invoke call won't work now because it calls module_hook which now checks whether module_exist and module_list() does not contain all modules. This check is new but won't break anything else because you are not supposed to force load not switched on modules.

The other function_exists are not removed but changed to module_exist because if you look into the script you'll see that function_exists gets changed to drupal_function_exists which is not module aware. Generally, you should use module_* to interact with a module.

#13

chx - November 1, 2005 - 14:34

Introducing another var, split_dir, defaults to split. Bart is right in that I should meddle with files.

AttachmentSizeStatusTest resultOperations
split_4.patch8.37 KBIgnoredNoneNone

#14

chx - November 1, 2005 - 14:35

The script got smaller with the new var. Yay!

AttachmentSizeStatusTest resultOperations
split.php_2.txt6.37 KBIgnoredNoneNone

#15

Bart Jansens - November 1, 2005 - 15:19

The patch looks good

I ran some quick tests, benchmarked the index.php page of a default drupal install. Using split mode was almost twice as fast as without. I did the same after I enabled all core modules, this time it was more than five times as fast. Of course this was a special situation; no opcode cache and a very simple page, but it shows some promising results.

I still encountered a few problems though:
- after changing the site status to offline, users get
Fatal error: Call to undefined function: drupal_site_offline() in /home/jabart/public_html/drupal/index.php on line 24

- on q=admin/comment/configure:
warning: array_filter(): An error occurred while invoking the filter callback in /home/jabart/public_html/drupal/files/split/el/element_children.inc on line 2.

warning: implode(): Bad arguments. in /home/jabart/public_html/drupal/files/split/fo/form_get_error.inc on line 7.

#16

chx - November 1, 2005 - 18:34

Thanks, Bart. Currently, my focus is on getting the split patch in.

Drupal_site_offline needs some thinking, but as it is very small, I will probably add it to exceptions.

I will check whether the other error occurs in HEAD... I can't see why the split mode would cause that, the relevant functon (element_child) is in exceptions, it's always loaded.

#17

beginner - November 5, 2005 - 05:56

A big +1 for this feature, for the reasons highlighted here:
http://drupal.org/node/32262#comment-53036

#18

eaton - November 5, 2005 - 06:31

+1 for compatability so far. I haven't looked closely at the memory aspect of it, but installed it on a stock 4.7 and have been poking around the system. No problems.

#19

chx - November 13, 2005 - 09:22
Status:needs review» reviewed & tested by the community

As a patch, I really feel it's ready. The only change is reroll against current HEAD.

AttachmentSizeStatusTest resultOperations
split_5.patch8.85 KBIgnoredNoneNone

#20

chx - November 28, 2005 - 15:47

Still applies with some offset. Instructions: apply http://drupal.org/files/issues/split_5.patch , create an apache writeable 'split' dir, add $conf = array('split_dir' => 'split' , 'split_mode' => 1); to settings.php and run http://drupal.org/files/issues/split.php_2.txt

#21

chx - November 28, 2005 - 21:00

Rerolled so that it applies without offset.

Note: script does not work with .theme files yet. I should add them. And probably .php , too.

AttachmentSizeStatusTest resultOperations
split_6.patch7.02 KBIgnoredNoneNone

#22

tsk1979 - December 7, 2005 - 09:30
Category:feature request» support request

Hi chx,
I am facing the drupal memory exausted problem. since I am on a shared server and cannot be allocated more than 16M of memory, this patch looked interesting. currently I am 4.6.4, is there a consise HOWTO on the steps needed to install this patch. do I have to do anything with my php installation etc., or will it work on the same PHP5 installation.

#23

chx - December 7, 2005 - 09:36

can not work w/ 4.6.4 that version does not have the necessary capabilities.

#24

killes@www.drop.org - December 7, 2005 - 10:41
Category:support request» feature request

It is still a feature. :)

#25

Wesley Tanaka - January 21, 2006 - 08:39

+1

#26

beginner - May 23, 2006 - 12:47
Status:reviewed & tested by the community» needs review

I rerolled the patch.

A few hunks failed.

In particular, I couldn't replace the following code, because apparently the whole block has disappeared.

<code>*** 571,577 ****

    if (!isset($title)) {
      // during a bootstrap, menu.inc is not included and thus we cannot provide a title
-     if (function_exists('menu_get_active_title')) {
        $title = check_plain(menu_get_active_title());
      }
    }
--- 576,582 ----

    if (!isset($title)) {
      // during a bootstrap, menu.inc is not included and thus we cannot provide a title
+     if (!drupal_bootstrap()) {
        $title = check_plain(menu_get_active_title());
      }
    }

But I think it would work as well as the previous patch.

AttachmentSizeStatusTest resultOperations
split_7.patch.txt8.08 KBIgnoredNoneNone

#27

beginner - August 6, 2006 - 06:50
Status:needs review» needs work

Well, it's probably out of sync again.

#28

LAsan - April 7, 2008 - 11:26
Version:x.y.z» 7.x-dev

chx: Is this patch implemented?

Moving to cvs.

#29

Susurrus - April 7, 2008 - 12:40

Hasn't this been superceded by the Registry?

#221964: Registry

#30

Crell - April 8, 2008 - 00:24
Status:needs work» duplicate

This has been superseded by the D6 page split and the D7 Registry.

 
 

Drupal is a registered trademark of Dries Buytaert.