/[drupal]/contributions/modules/acidfree/acidfree.install
ViewVC logotype

Contents of /contributions/modules/acidfree/acidfree.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.28 - (show annotations) (download) (as text)
Sat May 5 02:00:05 2007 UTC (2 years, 6 months ago) by vhmauery
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1
Changes since 1.27: +3 -0 lines
File MIME type: text/x-php
bail out of a duplicate upgrade
1 <?php
2 /* ex: set syntax=php tabstop=4 expandtab shiftwidth=4 softtabstop=4: */
3 // acidfree.install
4
5 function acidfree_uninstall() {
6 db_query('DROP TABLE {acidfree_album}');
7 db_query("DELETE FROM {variable} WHERE name LIKE '%acidfree%'");
8 taxonomy_del_vocabulary(variable_get('acidfree_vocab_id', 0));
9 views_invalidate_cache();
10 db_query("DELETE FROM {blocks} WHERE module = 'acidfree'");
11 }
12
13
14 function acidfree_install() {
15 switch ($GLOBALS['db_type']) {
16 case 'mysql':
17 case 'mysqli':
18 $query = "CREATE TABLE {acidfree_album} (
19 aid int(11) NOT NULL auto_increment,
20 tid int(11) NOT NULL default '0',
21 thumb varchar(255) NOT NULL default '',
22 share tinyint(5) NOT NULL default '0',
23 order_by VARCHAR(32) NOT NULL default '<default>',
24 view varchar(32) NOT NULL default 'grid',
25 PRIMARY KEY (aid)
26 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;";
27
28 break;
29 case 'pgsql':
30 $query = "CREATE TABLE {acidfree_album} (
31 aid SERIAL,
32 tid integer NOT NULL default '0',
33 thumb varchar(255) NOT NULL default '',
34 share smallint NOT NULL default '0',
35 order_by VARCHAR(32) NOT NULL default '<default>',
36 view varchar(32) NOT NULL default 'grid',
37 PRIMARY KEY (aid)
38 );";
39 break;
40 }
41 db_query($query);
42
43 variable_set('node_options_acidfree', array('status', 'sticky'));
44 db_query("UPDATE {system} SET weight=99 WHERE name='acidfree'");
45 // clearing the cache to eliminate views issues?
46 cache_clear_all('*', 'cache', true);
47 }
48
49 function acidfree_update_1() {
50 return _system_update_utf8(array('acidfree', 'acidfree_hierarchy'));
51 }
52
53 function acidfree_update_2() {
54 switch ($GLOBALS['db_type']) {
55 case 'mysql':
56 case 'mysqli':
57 $items[] = update_sql("ALTER TABLE {acidfree} ADD COLUMN share TINYINT(1) NOT NULL DEFAULT '0'");
58 break;
59
60 case 'pgsql':
61 // this could all be a single query in postgres 8.1,
62 // but 7.4 makes us do it in 4 queries
63 $items[] = update_sql("ALTER TABLE {acidfree} ADD COLUMN share SMALLINT");
64 $items[] = update_sql("UPDATE {acidfree} SET share=0 WHERE share IS NULL");
65 $items[] = update_sql("ALTER TABLE {acidfree} ALTER COLUMN share SET NOT NULL");
66 $items[] = update_sql("ALTER TABLE {acidfree} ALTER COLUMN share SET DEFAULT 0");
67 break;
68 }
69 db_query("DELETE FROM {variable} WHERE name='acidfree_types'");
70 cache_clear_all('variables', 'cache');
71 return $items;
72 }
73
74 /*
75 * UPDATE 3
76 *
77 * What a nightmare. With the complete rewrite of Acidfree
78 * to use Image and Video nodes for content and Taxonomy for
79 * albums, we have a lot of fixin' up to do to get this all
80 * working right for the new version. I didn't want to leave
81 * legacy code lying around in the module, so I stripped it out
82 * which left me with a few loose ends to tie up here while
83 * doing the update.
84 * All in all, this shouldn't happen again, since this is how
85 * Acidfree should have been from the beginning (but couldn't
86 * have for lack of good APIs). Read my lips, 'No more updates.'
87 * Famous last words.
88 */
89
90 function acidfree_update_3_okay() {
91 // make sure we are okay to update
92 $modules = array();
93 if (db_table_exists('acidfree')) {
94 if (db_result(db_query(
95 "SELECT COUNT(aid) FROM {acidfree} WHERE class='photo' LIMIT 1"
96 )) != 0) {
97 $modules[] = 'image';
98 }
99 if (db_result(db_query(
100 "SELECT COUNT(aid) FROM {acidfree} WHERE class='video' LIMIT 1"
101 )) != 0) {
102 $modules[] = 'video';
103 $modules[] = 'video_upload';
104 $modules[] = 'video_image';
105 }
106 }
107 $missing_modules = array();
108 foreach ($modules as $module) {
109 if (!module_exists($module)) {
110 $missing_modules[] = $module;
111 }
112 }
113 return $missing_modules;
114 }
115
116 function acidfree_update_order_conversion($order) {
117 if ($order == 'iage') {
118 return 'node.nid DESC';
119 }
120 if ($order == 'age') {
121 return 'node.nid ASC';
122 }
123 if ($order == 'alpha') {
124 return 'node.title DESC';
125 }
126 return '<default>';
127 }
128
129 function acidfree_update_3_album_tree($root, $ptid=0) {
130 static $nid2tid = array();
131 static $vid = null;
132 if (!isset($vid)) {
133 $vid = acidfree_get_vocab_id();
134 }
135 $root = acidfree_update_3_node_load($root);
136 if ($root->thumb) {
137 $root->thumb = db_result(db_query('SELECT aid FROM {acidfree} JOIN {file} on thumb = fid WHERE fid = %d AND class <> \'album\'', $root->thumb));
138 }
139 $root->taxonomy[$vid] = array($ptid);
140 $root->order_by = acidfree_update_order_conversion($root->sort);
141 acidfree_insert($root);
142 if ($ptid == 0) {
143 variable_set('acidfree_root_term_id', $root->tid);
144 }
145 $nid2tid[$root->nid] = $root->tid;
146 taxonomy_node_save($root->nid, $root->taxonomy);
147 $children = db_query("SELECT n.nid FROM {node} n JOIN {acidfree} a ON n.nid = a.aid JOIN {acidfree_hierarchy} h ON n.nid = h.child WHERE a.class = 'album' AND h.parent = %d", $root->nid);
148 while ($child = db_fetch_array($children)) {
149 acidfree_update_3_album_tree($child['nid'], $root->tid);
150 }
151 return $nid2tid;
152 }
153
154 function acidfree_update_3_node_common(&$node, &$lookup) {
155 foreach ($node->parent as $parent) {
156 $terms[] = $lookup[$parent];
157 }
158 if (!is_array($node->taxonomy)) {
159 $node->taxonomy = $terms;
160 } else {
161 $node->taxonomy = array_merge($node->taxonomy, $terms);
162 }
163 taxonomy_node_save($node->nid, $node->taxonomy);
164 }
165
166 function acidfree_update_3_node_load($nid) {
167 $node = node_load($nid);
168 $items = db_fetch_array(db_query("SELECT * FROM {acidfree} WHERE aid=%d", $node->nid));
169 if ($items['class'] == 'album') {
170 $unserial = unserialize($items['small']);
171 if (is_array($unserial)) {
172 foreach ($unserial as $key => $value) {
173 $items[$key] = $value;
174 }
175 }
176 $items['small'] = '';
177 }
178 foreach ($items as $key => $value) {
179 $node->$key = $value;
180 }
181 $result = db_query("SELECT parent FROM {acidfree_hierarchy} WHERE child = %d", $node->nid);
182 while ($p = db_fetch_object($result)) {
183 $parents[] = $p->parent;
184 }
185 if (!isset($parents))
186 $parents = array(acidfree_update_3_get_root());
187 $node->parent = $parents;
188 return $node;
189 }
190
191 function acidfree_update_3_get_root() {
192 return db_result(db_query('SELECT nid FROM {node} JOIN {acidfree} ON nid=aid '.
193 'JOIN {acidfree_hierarchy} ON aid=child WHERE parent=\'%d\'', -1));
194 }
195
196 function acidfree_update_3_user_root($uid) {
197 $root = acidfree_update_3_get_root();
198 return db_result(db_query('SELECT nid FROM {node} JOIN {acidfree} ON nid=aid '.
199 'JOIN {acidfree_hierarchy} ON aid=child '.
200 'WHERE parent=\'%d\' AND uid=\'%d\'', $root, $uid));
201 }
202
203 function acidfree_update_3_do_conversion() {
204 /*
205 * convert the albums
206 */
207 $vid = acidfree_get_vocab_id();
208 $root = acidfree_update_3_get_root();
209 $new_root = acidfree_update_3_album_tree($root);
210 drupal_set_message(t('finished updating albums'));
211
212 /*
213 * convert the images
214 */
215 _image_check_settings();
216 // preserve image size settings -- copy from acidfree to image module
217 $preview_size = variable_get('acidfree_small_dim', IMAGE_SMALL_SIZE);
218 $thumb_size = variable_get('acidfree_thumb_dim', IMAGE_THUMB_SIZE);
219 $sizes = _image_get_sizes();
220 foreach ($sizes as $key=>$size) {
221 if ($size['label'] == 'thumbnail') {
222 $sizes[$key]['height'] = $sizes[$key]['width'] = $thumb_size;
223 } else if ($size['label'] == 'preview') {
224 $sizes[$key]['height'] = $sizes[$key]['width'] = $preview_size;
225 }
226 }
227 variable_set('image_sizes', $sizes);
228 variable_set('image_updated', time());
229 variable_del('acidfree_small_dim');
230 variable_del('acidfree_thumb_dim');
231 // import images
232 $images = db_query("SELECT n.nid FROM {node} n JOIN {acidfree} a ON n.nid = a.aid
233 WHERE type='acidfree' AND class='photo'");
234 $sizes = array('large' => '_original', 'small' => 'preview', 'thumb' => 'thumbnail');
235 while ($image = db_fetch_array($images)) {
236 $image = acidfree_update_3_node_load($image);
237 foreach ($sizes as $size => $label) {
238 $fmimage = db_fetch_object(db_query("SELECT * FROM {file} WHERE fid = '{$image->$size}'"));
239 // continue only if file was really found
240 if ($fmimage) {
241 if (strstr($fmimage->filename, 'tmp')) {
242 $pinfo = pathinfo($filename);
243 $fmimage = filemanager_rename($fmimage, "{$image->nid}_{$size}.{$pinfo['extension']}");
244 }
245 $old_path = filemanager_create_path($fmimage);
246 _image_insert($image, $label, $old_path);
247 filemanager_delete($fmimage);
248 }
249 }
250 acidfree_update_3_node_common($image, $new_root);
251 }
252 db_query("UPDATE {node} n JOIN {acidfree} a ON n.nid=a.aid SET n.type='image' WHERE n.type='acidfree' AND a.class='photo'");
253
254 drupal_set_message(t('Finished updating images'));
255
256 /*
257 * convert the videos
258 */
259 $videos = db_query("SELECT n.nid from {node} n JOIN {acidfree} a on n.nid = a.aid
260 WHERE type='acidfree' AND class='video'");
261 // convert videos only if there's something to do
262 if (db_num_rows($videos) > 0) {
263 _video_upload_check_settings();
264 while ($video = db_fetch_array($videos)) {
265 $video = acidfree_update_3_node_load($video);
266 $video->type = 'video';
267 foreach (array_keys($sizes) as $size) {
268 $fmimage = db_fetch_object(db_query("SELECT * FROM {file} WHERE fid = '{$video->$size}'"));
269 switch ($size) {
270 case 'thumb':
271 break;
272 case 'small':
273 /* invoke the video_image stuff */
274 $file = (object)array(
275 'filename' => $fmimage->filename,
276 'filemime' => $fmimage->mimetype,
277 'filesize' => $fmimage->size,
278 'filepath' => filemanager_create_path($fmimage)
279 );
280 $thumb = $video;
281 $thumb->type = 'image';
282 $thumb->status = 0;
283 $thumb->promote = 0;
284 $thumb->taxonomy = array();
285 $thumb->sticky = 0;
286 unset($thumb->nid);
287 unset($thumb->vid);
288 image_prepare($thumb, $file);
289 $thumb = node_submit($thumb);
290 node_save($thumb);
291 $video->serial_data['iid'] = $thumb->nid;
292 $iminfo = image_get_info($file->filepath);
293 // we can do the lazy man way or we can extract info using ffmpeg on the video file
294 $video->videox = $iminfo->width;
295 $video->videoy = $iminfo->height;
296 break;
297 case 'large':
298 /* invoke the video_upload stuff */
299 $file = (object)array(
300 'filename' => $fmimage->filename,
301 'filemime' => $fmimage->mimetype,
302 'filesize' => $fmimage->size,
303 'filepath' => filemanager_create_path($fmimage)
304 );
305 $_SESSION['video_upload_file'] = $file;
306 _video_upload_store($video);
307 }
308 filemanager_delete($fmimage);
309 }
310 acidfree_update_3_node_common($video, $new_root);
311 video_insert($video);
312 }
313 db_query("UPDATE {node} n JOIN {acidfree} a ON n.nid=a.aid SET n.type='video' WHERE n.type='acidfree' AND a.class='video'");
314 drupal_set_message(t('finished updating videos'));
315 }
316 }
317
318 $current_db = db_result(db_query("SELECT schema_version from {system} WHERE name='%s'", 'acidfree'));
319
320 if (count($missing = acidfree_update_3_okay()) == 0 || $current_db >= 3) {
321 function acidfree_update_3() {
322 acidfree_update_3_okay();
323 if (db_table_exists('acidfree_album')) {
324 return array();
325 }
326 switch ($GLOBALS['db_type']) {
327 case 'mysqli':
328 case 'mysql':
329 $items[] = update_sql("CREATE TABLE {acidfree_album} (aid INT(11) NOT NULL auto_increment, tid int(11) NOT NULL default '0', thumb INT(11) NOT NULL default '0', share INT(1) NOT NULL default '0', order_by VARCHAR(32) NOT NULL default 'n.nid DESC', view varchar(32) NOT NULL default 'grid', PRIMARY KEY (aid)) type=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
330 break;
331 case 'pgsql':
332 $items[] = update_sql("CREATE TABLE {acidfree_album} (aid SERIAL, tid integer NOT NULL default '0', thumb integer NOT NULL default '0', share smallint NOT NULL default '0', order_by VARCHAR(32) NOT NULL default 'n.nid DESC', view varchar(32) NOT NULL default 'grid', PRIMARY KEY (aid));");
333 break;
334 }
335
336 /* bail out early if we don't have any work to do */
337 if (!db_result(db_query("SELECT COUNT(n.nid) AS count FROM {node} n WHERE type='acidfree'"))) {
338 return $items;
339 }
340
341 // get the non-per-user-albums albums
342 acidfree_update_3_do_conversion();
343
344 if (variable_get('acidfree_per_user_albums', false)) {
345 // get each user's albums
346 $users = db_query('SELECT uid FROM {users} WHERE uid > 1');
347 while (($user = db_fetch_object($users))) {
348 // reset the user album parent tids to 0
349 }
350 }
351 if (db_table_exists('acidfree'))
352 $items[] = update_sql("DROP TABLE {acidfree}");
353 if (db_table_exists('acidfree_hierarchy'))
354 $items[] = update_sql("DROP TABLE {acidfree_hierarchy}");
355
356 db_query('truncate table {cache}');
357 db_query('truncate table {cache_page}');
358 db_query('truncate table {cache_filter}');
359 db_query('truncate table {cache_menu}');
360 variable_del('acidfree_types');
361 variable_del('acidfree_video_thumbnailer');
362 variable_del('acidfree_default_video_width');
363 variable_del('acidfree_default_video_height');
364 return $items;
365 }
366 } else {
367 if (strstr($_SERVER['PHP_SELF'], 'upgrade.php')) {
368 echo t('The following modules are missing and prevent Acidfree from being upgraded:');
369 echo "<pre>\n";
370 print_r($missing);
371 echo "</pre>\n";
372 }
373 }
374 if (function_exists('acidfree_update_3') && !function_exists('filemanager_rename')) {
375 // supply filemanager functions if they are not enabled
376 function filemanager_rename($file, $name) {
377 $file = filemanager_get_file_info($file);
378
379 // Exit immediately if the rename does nothing
380 if (! $file || $name == $file->filename) {
381 return $file;
382 }
383
384 // Begin rename operation
385 $oldworking = filemanager_create_path($file, true);
386 $oldactive = filemanager_create_path($file, false);
387 $lock = _filemanager_lock();
388
389 $file->filename = $name;
390
391 $updated = _filemanager_update_file($file, $oldworking, $oldactive);
392
393 if ($file != false) {
394 db_query("UPDATE {file} SET filename = '%s', directory = '%d' WHERE fid=%d", $file->filename, $file->directory, $file->fid);
395 }
396 _filemanager_unlock($lock);
397 return $file;
398 }
399 function filemanager_delete($file) {
400 $file = filemanager_get_file_info($file);
401 file_delete(filemanager_create_path($file, TRUE));
402 file_delete(filemanager_create_path($file, FALSE));
403 db_query("DELETE FROM {file} WHERE fid=%d", $file->fid);
404 }
405 function filemanager_get_file_info($file) {
406 if (is_object($file)) {
407 return $file;
408 }
409 $result = db_query("SELECT fid, area, directory, filename, mimetype, size, active, working, private FROM {file} WHERE fid = %d", $file);
410 return db_fetch_object($result);
411 }
412 function filemanager_create_path($file, $working = FALSE) {
413 $file = filemanager_get_file_info($file);
414 return filemanager_create_directory_path($file->private, $working, $file->directory) . '/' . $file->filename;
415 }
416 function filemanager_create_directory_path($private = FALSE, $working = FALSE, $subdir = FALSE) {
417 return ($private ? variable_get('filemanager_private_path', 'private') : variable_get('filemanager_public_path', 'files')) . '/' . ($working ? 'working' : 'active') . ($subdir !== FALSE ? '/' . $subdir : '');
418 }
419 function filemanager_create_directory($directory) {
420 if (!file_exists($directory)) {
421 mkdir($directory);
422 }
423 }
424 function _filemanager_update_file(&$file, $oldworking, $oldactive) {
425 // Using the new file object find/create an appropiate area for this file
426 $file = _filemanager_find_directory($file);
427 $newworking = filemanager_create_path($file, true);
428 $newactive = filemanager_create_path($file, false);
429 if (file_exists($oldworking)) {
430 filemanager_create_directory(dirname(dirname($newworking)));
431 filemanager_create_directory(dirname($newworking));
432 if (!_filemanager_move($oldworking, $newworking, FILE_EXISTS_ERROR)) {
433 drupal_set_message(t('file exists: %fn', array('%fn' => $file->filename)), 'error');
434 return false;
435 }
436 }
437 if (file_exists($oldactive)) {
438 filemanager_create_directory(dirname(dirname($newactive)));
439 filemanager_create_directory(dirname($newactive));
440 if (!_filemanager_move($oldactive, $newactive, FILE_EXISTS_ERROR)) {
441 drupal_set_message(t('file exists: %fn', array('%fn' => $file->filename)), 'error');
442 return false;
443 }
444 }
445
446 return true;
447 }
448 function _filemanager_move(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
449 $path_original = is_object($source) ? $source->filepath : $source;
450
451 if (_filemanager_copy($source, $dest, $replace)) {
452 $path_current = is_object($source) ? $source->filepath : $source;
453
454 if ($path_original == $path_current || file_delete($path_original)) {
455 return 1;
456 }
457 drupal_set_message(t('The removal of the original file %file has failed.', array('%file' => theme('placeholder', $source))), 'error');
458 }
459 return 0;
460 }
461 function _filemanager_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
462 $directory = $dest;
463 $basename = file_check_path($directory);
464
465 // Make sure we at least have a valid directory.
466 if ($basename === false) {
467 drupal_set_message(t('The selected file %file could not be uploaded, because the destination %directory is not properly configured.', array('%file' => theme('placeholder', $source), '%directory' => theme('placeholder', $dest))), 'error');
468 watchdog('file system', t('The selected file %file could not not be uploaded, because the destination %directory could not be found, or because its permissions do not allow the file to be written.', array('%file' => theme('placeholder', $source), '%directory' => theme('placeholder', $dest))), WATCHDOG_ERROR);
469 return 0;
470 }
471
472 // Process a file upload object.
473 if (is_object($source)) {
474 $file = $source;
475 $source = $file->filepath;
476 if (!$basename) {
477 $basename = $file->filename;
478 }
479 }
480
481 $source = realpath($source);
482
483 if (!file_exists($source)) {
484 drupal_set_message(t('The selected file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.', array('%file' => theme('placeholder', $source))), 'error');
485 return 0;
486 }
487
488 // If the destination file is not specified then use the filename of the
489 // source file.
490 $basename = $basename ? $basename : basename($source);
491 $dest = $directory .'/'. $basename;
492
493 // Make sure source and destination filenames are not the same, makes no sense
494 // to copy it if they are. In fact copying the file will most likely result in
495 // a 0 byte file. Which is bad. Real bad.
496 if ($source != realpath($dest)) {
497 if (file_exists($dest)) {
498 switch ($replace) {
499 case FILE_EXISTS_RENAME:
500 // Destination file already exists and we can't replace is so we try
501 // and and find a new filename.
502 if ($pos = strrpos($basename, '.')) {
503 $name = substr($basename, 0, $pos);
504 $ext = substr($basename, $pos);
505 }
506 else {
507 $name = $basename;
508 }
509
510 $counter = 0;
511 do {
512 $dest = $directory .'/'. $name .'_'. $counter++ . $ext;
513 } while (file_exists($dest));
514 break;
515
516 case FILE_EXISTS_ERROR:
517 drupal_set_message(t('The selected file %file could not be copied, because a file by that name already exists in the destination.', array('%file' => theme('placeholder', $source))), 'error');
518 return 0;
519 }
520 }
521
522 if (!@copy($source, $dest)) {
523 drupal_set_message(t('The selected file %file could not be copied.', array('%file' => theme('placeholder', $source))), 'error');
524 return 0;
525 }
526
527 // Give everyone read access so that FTP'd users or non-webserver users
528 // can see/read these files.
529 @chmod($dest, 0664);
530 }
531
532 if (is_object($file)) {
533 $file->filename = $basename;
534 $file->filepath = $dest;
535 $source = $file;
536 }
537 else {
538 $source = $dest;
539 }
540
541 return 1; // Everything went ok.
542 }
543 function _filemanager_find_directory(&$file) {
544 // Find a directory that is not already full and does not contain our files
545 $file->directory = 0;
546 $directories = db_query("SELECT directory, count(1) AS filecount FROM {file} WHERE private = '%s' GROUP BY directory ORDER BY directory ASC", $file->private);
547
548 // this while loop requires the $directories array to be ordered in ascending order
549 while ($directory = db_fetch_object($directories)) {
550 // The idea here is to find a directory where the filename doesn't exist
551 // and we haven't hit the maximum file limit. The directories are named
552 // numerically and the first part of the test makes sure that the they're
553 // filled in sequenceially. $file->directory is incremented by 1 each time
554 // but $directory->directory comes from the database. If
555 // $directory->directory > $file->directory, then $file->directory doesn't
556 // exist and would be a safe place to save the file.
557 if ($directory->directory > $file->directory || $directory->filecount < variable_get('filemanager_max_file_count', '2000')) {
558 // If the directory is ok now lets make sure we don't already have this
559 // filename in the directory (checking both working and active).
560 if (!file_exists(filemanager_create_path($file, FALSE)) && !file_exists(filemanager_create_path($file, TRUE))) {
561 break;
562 }
563 }
564 $file->directory++;
565 }
566 return $file;
567 }
568 function _filemanager_lock() {
569 $lock_file = variable_get('filemanager_private_path', 'private') .'/'. 'filemanager.lck';
570 $flk = fopen($lock_file,'w+');
571 flock($flk, LOCK_EX);
572 return $flk;
573 }
574 function _filemanager_unlock(&$handle) {
575 flock($handle, LOCK_UN);
576 fclose($handle);
577 }
578 } // end of filemanager functions
579
580 if (function_exists('acidfree_update_3') || $current_db >= 3) {
581 function acidfree_update_4() {
582 $num_thumbs = variable_get('acidfree_cols', 5) * variable_get('acidfree_rows', 3);
583 if ($num_thumbs < 0) {
584 $num_thumbs = 0;
585 }
586 variable_set('acidfree_num_thumbs', $num_thumbs);
587 db_query("DELETE FROM {variable} WHERE name = 'acidfree_cols'");
588 db_query("DELETE FROM {variable} WHERE name = 'acidfree_rows'");
589 $order = variable_get('acidfree_order', NULL);
590 if (!is_null($order)) {
591 $order = acidfree_update_order_conversion($order);
592 if ($order == '<default>') {
593 $order = 'node.nid DESC';
594 }
595 variable_set('acidfree_order', $order);
596 }
597 db_query("UPDATE {system} SET weight=99 WHERE name='%s'", 'acidfree');
598 return array();
599 }
600 }
601 ?>

  ViewVC Help
Powered by ViewVC 1.1.2