Re: Best practice to add my changes and keep the ability to install future updates
Michael J Rubinsky <[email protected]>
| Newsgroups | gmane.comp.horde.devel |
|---|---|
| Message-ID | <20160110223320.Horde.3ALxMcPTqDU9i-lBiz_6p_i@h4.theupstairsroom.com> |
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. -- mike The Horde Project http://www.horde.org https://www.facebook.com/hordeproject https://www.twitter.com/hordeproject -- dev mailing list Frequently Asked Questions: http://wiki.horde.org/FAQ To unsubscribe, mail: [email protected]
smime.p7s
(application/pkcs7-signature, 5.6 KB) - not displayed