Drupal Development
Partial Install Profiles
Agaric wants configuration profiles, that potentially can be combined, as well as applied later than the original installation.
And it seems like we can have it!
- ben
Salesforce uncaught exception: always more to hate about the dark side of the force
Fatal error: Uncaught SoapFault exception: [soapenv:Client] The reference to entity "ie" must end with the ';' delimiter.
Too-true Typo of the Week: the wanders of unit testing
The too-true typo of the week, from Kyle Mathews' Unit Testing Success Story:
The Lullabot crew had a recent podcast on the wanders of unit testing.
The wanders, indeed.
Agaric Utility function: set default values in an array
the original line is almost as short as the function, but if we want to add checking on "empty()" or need to change anything else, it's all in one place
/**
* Set a default value for an array key if that key does not exist.
*
* The _au_ namespace stands for agaric utility, and are things
* we may reuse in so many modules we'll want to put in a helper
Forward Drupal path to an external URL
UPDATE: A better, universal approach which should be all you need is immediately here--
Simply provide the internal path that really belongs to the old site (in 'path', and the URL you want to send things with this path to, in the 'url' value of 'callback arguments').
Set a module weight using its .install file
in placement.install
<?php
function placement_install() {
db_query("UPDATE {system} SET weight = 10 WHERE name = 'placement'");
}
?>The query is the same in both MySQL and PostgreSQL so for these databases (which are what Drupal core supports) this does not need to be placed in a switch statement.
Using CVS for developing modules
Using CVS for developing modules
We can commit to Drupal.org CVS and use it just like we use subversion to manage our sites. No more trying to develop a module in subversion and contribute changes to CVS, just do everything in CVS. It's not that much worse than SVN.
Watch:
In the home local checkout:
Creating a random password... the Drupal way
Lesson of the day: don't reinvent Drupal functions.
<?php
/**
* Generate a really lame random password. This would be cooler with words.
*
* Still, gratitude to Jon Haworth, from whom this code was taken.
* http://www.laughing-buddha.net/jon/php/password/
*/
function changents_tl_au_rand_password($length = 5) {
// start with a blank password
$password = "";
Making a quick random number
Not truly random in some cosmic computer science sense, but good enough for non-mission critical (or rather, nothing for anyone to exploit the not-complete-randomness) uses.
http://www.php-scripts.com/php_diary/122799.php3
<?php
srand(time());
$random = (rand()%9);
?>