This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$module = 'my_module'; | |
$table = 'my_table'; | |
$ret = array(); | |
db_drop_table($ret, $table); | |
$schema = drupal_get_schema_unprocessed($module); | |
db_create_table($ret, $table, $schema[$table]); | |
dpm($ret); // print return values - queries and success state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="" method="get"> | |
Old prefix: <input type="text" name="old" /> <br /> | |
New prefix: <input type="text" name="new" /> <br /> | |
<input type="submit" value="Rename" /> | |
</form> | |
<?php | |
global $db_prefix; | |
if ($old = $_REQUEST['old'] || $new = $_REQUEST['new']) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mymodule_wizard_submit($form, &$form_state) { | |
$wizard = $form_state['values']['wizard']; | |
// $form_state['redirect'] = lazy drupal_goto, has the same parameters | |
$path = trim(parse_url($form['#action'], PHP_URL_PATH), '/'); | |
$query = array('sender' => $wizard['sender'], 'recipient' => $wizard['recipient']); | |
$form_state['redirect'] = array($path, $query); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REPLACE? | |
$replace = FALSE; | |
// path to empty file | |
$source = 'files/empty.png'; | |
// RUN | |
$result = db_query('SELECT fid, filename, filepath FROM {files}'); | |
$src = file_create_path($source); | |
$src_exists = file_exists($src); | |
$i = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ok! | |
If you (like me) are wondering what's up with there being 3 separate OpenID critical issues between D8 and D7 and what on earth it all means, and more importantly how to fix it, you're in luck! wojtha kindly spent about an hour with me in IRC today walking me through the state of things. | |
Here's the skinny: | |
There are two main issues where core's OpenID module is violating spec, and this leads to consequences ranging from certain OpenID providers just plain not working to possible impersonation risks: | |
[#575810]: When you enter an OpenID provider like "webchick.openid.com", Drupal normalize it into a fully-qualified domain for you, like "http://webchick.openid.com", sets it as a user Claimed Ideintifier and sends a request to that URL to retrieve supported services from the provider and that kind of stuff. The problem is that all public providers (and probably all of the providers around the world) redirects "http://webchick.openid.com" to more secure https://webchick.openid.com or sometimes to completel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Merges two multi-dimensional arrays. | |
* | |
* Taken from http://drupalcontrib.org/api/search/6/swftools_array_merge | |
* | |
* This function is used by players that filter their settings to strip out | |
* blanks or defaults. For the admin page we need a full set of values to prevent | |
* errors. Since the arrays might be multi-dimensional we cannot use a regular | |
* array_merge(). The values in the first array will be over-written by values in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$purge = FALSE; | |
$result = db_query('SELECT fid, filename, filepath FROM {files}'); | |
$i = 1; | |
$out = "MISSING FILES:\n"; | |
while ($f = db_fetch_object($result)) { | |
$dest = file_create_path($f->filepath); | |
if (!file_exists($dest)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
php_syntax_check() | |
{ | |
retval=0 | |
for i in $(git diff-index --name-only --cached HEAD -- | grep -E '\.(php|engine|theme|install|inc|module|test)$'); do | |
if [ -f $i ]; then | |
output=$(/c/progra~2/zend/zendserver/bin/php.exe -l $i) | |
if [ "$output" == "No syntax errors detected in $i" ]; | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git functions | |
# Mark Embling (http://www.markembling.info/) | |
# Is the current directory a git repository/working copy? | |
function isCurrentDirectoryGitRepository { | |
if ((Test-Path ".git") -eq $TRUE) { | |
return $TRUE | |
} | |
# Test within parent dirs |
OlderNewer