[dev] Best practice to add my changes and keep the ability to install future updates

Ralf Lang lang at b1-systems.de
Wed Jan 13 13:10:04 UTC 2016


On 11.01.2016 04:33, Michael J Rubinsky wrote:
> 
> Quoting Hendrik <lists at object.earth>:
> 
>> Hello List,
>>
>>
>> thank you very much for all of your efforts, creating and maintaining
>> this amazing software project.
>>
>> I am new to Horde and its components. Setting it up was easier than
>> expected and things work just fine.
>>
>> Now I would like to extend and change some functionality, but I am
>> lacking information about the best practices.
>> And that is why I am writing to you.
>>
>> For example, I would like to change this function:
>>
>> Horde_Auth::genRandomPassword()
>>
>> found in php/Horde/Auth.php at line 316:
>>
>>     /**
>>      * Generates a random, hopefully pronounceable, password. This can
>> be used
>>      * when resetting automatically a user's password.
>>      *
>>      * @return string A random password
>>      */
>>     public static function genRandomPassword()
>>     {
>>         /* Alternate consonant and vowel random chars with two random
>> numbers
>>          * at the end. This should produce a fairly pronounceable
>> password. */
>>         return substr(self::CONSONANTS, mt_rand(0,
>> strlen(self::CONSONANTS) - 1), 1) .
>>             substr(self::VOWELS, mt_rand(0, strlen(self::VOWELS) - 1),
>> 1) .
>>             substr(self::CONSONANTS, mt_rand(0, strlen(self::CONSONANTS)
>> - 1), 1) .
>>             substr(self::VOWELS, mt_rand(0, strlen(self::VOWELS) - 1),
>> 1) .
>>             substr(self::CONSONANTS, mt_rand(0, strlen(self::CONSONANTS)
>> - 1), 1) .
>>             substr(self::NUMBERS, mt_rand(0, strlen(self::NUMBERS) - 1),
>> 1) .
>>             substr(self::NUMBERS, mt_rand(0, strlen(self::NUMBERS) -
>> 1), 1);
>>     }
>>
>>
>>
>>
>> Of course I could simply change this function so it does exactly what I
>> want.
>> But as soon as I install an update, I assume, my changes might get
>> undone.
>>
>> Since this function does not contain a hook I am wondering, what's the
>> best practice to add my changes and keep the ability to install future
>> updates?
> 
> For something like this, that has no hook or other possibility to
> customize, you will need to create/maintain your own patches and
> re-apply after updating. If you have done a lot of customization you
> could utilize Git to manage this.
> 

Other options are quilt or applying the patches through a package
management (rpm, deb) https://build.opensuse.org


-- 
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail: lang at b1-systems.de
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.horde.org/archives/dev/attachments/20160113/d06a1ca3/attachment.bin>


More information about the dev mailing list