Re: Consistent Class Renaming (Simple Refactoring)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16 May 2011 23:12, Tony Mak <duranis2004@xxxxxxxxxxx> wrote:
> Hi there,
>
> i have following problem:
>
> Assume we have a "cron.php" which is called every hour by a cron job. This
> cron.php should then be used to execute other php-scripts "script1.php",
> "script2.php".
>
> For a pitty our server has Safe-Mode activated so we arent able to
> shell_exec / exec those files. So we came up with the idea: Lets include
> those scripts using include(). But this lead us to another problem:
> Namespace conflicts (our server is running php 2.7.2) especially with
> classes and constants.
>
> Example:
> <<script1.php>>
> <?php
> class A {
> Âpublic function test(){ echo "im class A at script 1"; }
> }
> ?>
>
> <<script2.php>>
> <?php
> class A {
> Âpublic function test(){ echo "im class A at script 2"; }
> }
> ?>
>
> <<cron.php>>
> <?php
>
> include('./script1.php');
> include('./script2.php');
> ?>
>
>
> Cron.php will raise a "cannot redefine class A" error.
>
> So my idea is to continously rename every occurence of class names and
> constants in the scripts by adding a suffix (ie. class A_123 and class
> A_234). Do you have an idea how to implement this during the deployment
> step?
>
> Sincerly yours
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

"2.7.2"? I'm guessing 5.7.2.

The only way I could think of would be to use namespaces, but that
would involve some reworking.

And only for V5.3+

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux