Re: Best practice to add my changes and keep the ability to install future updates

Ralf Lang <[email protected]>
Newsgroups gmane.comp.horde.devel
Message-ID <[email protected]>
On 11.01.2016 04:33, Michael J Rubinsky wrote:
> 
> Quoting Hendrik <[email protected]>:
> 
>> 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: [email protected]
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlaWTK4ACgkQCs1dsHJ/X7CRiwCfRsLVQFjQXo6k/ipiP5k48C6C
I3MAoIvV5MrLL8Hi0jNCtvMY6XfqGeAx
=7TbA
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.