get bootstrap phase is uuuuuuuugly

chx - October 19, 2008 - 17:46
Project:Drupal
Version:7.x-dev
Component:base system
Category:bug report
Priority:critical
Assigned:chx
Status:closed
Description

That's some ugly code. We can do better.

AttachmentSize
get_bootstrap_phase_no_global_oh_my.patch1.88 KB

#1

chx - October 19, 2008 - 18:02

DamZ complained that I return the phase we are in and not the one we completed. But if we are to keep the completed_phase then we can refactor the whole function to something more simpler...

AttachmentSize
get_bootstrap_phase_collateral.patch 1.85 KB

#2

Damien Tournoud - October 19, 2008 - 18:06
Status:needs review» reviewed & tested by the community

$ egrep -r _drupal_current_bootstrap_phase .
./includes/bootstrap.inc:    global $_drupal_current_bootstrap_phase;
./includes/bootstrap.inc:    $_drupal_current_bootstrap_phase = $current_phase;
./includes/bootstrap.inc:  global $_drupal_current_bootstrap_phase;
./includes/bootstrap.inc:  return $_drupal_current_bootstrap_phase;

$_drupal_current_bootstrap was not used anywhere outside those two functions.

I have nothing to add...

#3

Dries - October 19, 2008 - 21:27
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks all.

#4

Damien Tournoud - October 19, 2008 - 22:32
Status:fixed» active

This broke the installer.

#5

Damien Tournoud - October 19, 2008 - 22:37
Priority:normal» critical
Status:active» needs review

Pfff.

Note to self: review chx' patches with a critical eye.

AttachmentSize
323372-bootstrap-fix.patch 950 bytes

#6

Damien Tournoud - October 19, 2008 - 22:39

Better yet.

AttachmentSize
323372-bootstrap-fix.patch 1018 bytes

#7

Dave Reid - October 19, 2008 - 23:19

Should we also remove the now-unnecessary drupal_get_bootstrap_phase function or separate patch?

#8

Damien Tournoud - October 19, 2008 - 23:20

No we don't need to remove it. It's a clean API, for once, please don't remove it :)

#9

boombatower - October 19, 2008 - 23:34
Status:needs review» reviewed & tested by the community

Last two patches fix issue and get all passes.

http://testing.drupal.org/pifr/node/1/323372

or even like:
http://testing.drupal.org/pifr/file/drupal.org/323372-bootstrap-fix.patch

When this gets in it would be nice if I was notified so I can update t.d.o. We seem to be getting a number of these that I have to hack t.d.o in the mean time.

#10

Dries - October 20, 2008 - 11:33
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks! :)

#11

Anonymous (not verified) - November 3, 2008 - 11:41
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.