Commit 8ee42a26 authored by moshe weitzman's avatar moshe weitzman

fix php5 error, make compatible with proposed patch tp HEAD

parent cc267f72
......@@ -23,7 +23,7 @@ INSTALLATION:
If running Drupal on Windows you will also need supporting .exe files http://sourceforge.net/project/showfiles.php?group_id=55859&package_id=105260
2. Patch the modules/upload.module file using the file upload.module.patch.txt
2. If needed, patch the modules/upload.module file using the most recent attachment to http://drupal.org/node/18934. If that issue is marked FIXED, and you are using HEAD or Drupal 4.7, then you need not patch at all.
3. Create the database tables using the media.module.mysql.sql file. This module has only been tested with MySQL.
......
<?PHP
<?php
/**
* Implementation of hook_node_name().
*/
......@@ -39,12 +40,11 @@ function media_help($section) {
* For the media module, update and insert both depend on the external getID3
* library to read the metadata from audio and video files.
*/
function media_fileapi($op, &$file) {
function media_file($op, &$file) {
switch ($op) {
case 'update':
case 'insert':
if (media_is_supported_type($file->filemime)) {
media_include_library();
......@@ -987,7 +987,7 @@ function media_array_to_columns($prefix = NULL, $array) {
} else {
$new_prefix = $name;
}
$result = array_merge($result, media_array_to_columns($new_prefix, $value));
$result = array_merge((array) $result, media_array_to_columns($new_prefix, $value));
} else {
if ($prefix) {
$result[$prefix.'_'.$name] = $value;
......
Index: upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload.module,v
retrieving revision 1.34
diff -u -r1.34 upload.module
--- upload.module 7 May 2005 02:00:34 -0000 1.34
+++ upload.module 13 May 2005 08:04:25 -0000
@@ -297,7 +297,7 @@
foreach ($node->files as $file) {
if ($file->list) {
$files[] = $file;
- }
+ }
}
if (count($files) > 0) {
// RSS only allows one enclosure per item
@@ -334,8 +334,10 @@
// Insert new files:
if ($file = file_save_upload($file, $file->filename)) {
$fid = db_next_id('{files}_fid');
+ $file->fid = $fid;
db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize, list) VALUES (%d, %d, '%s', '%s', '%s', %d, %d)",
$fid, $node->nid, $file->filename, $file->filepath, $file->filemime, $file->filesize, $node->list[$key]);
+ module_invoke_all('fileapi', 'insert', $file);
}
}
else {
@@ -343,9 +345,11 @@
if ($node->remove[$key]) {
file_delete($file->filepath);
db_query("DELETE FROM {files} WHERE fid = %d", $key);
+ module_invoke_all('fileapi', 'delete', $file);
}
if ($file->list != $node->list[$key]) {
db_query("UPDATE {files} SET list = %d WHERE fid = %d", $node->list[$key], $key);
+ module_invoke_all('fileapi', 'update', $file);
}
}
}
@@ -358,6 +362,7 @@
file_delete($file->filepath);
}
db_query("DELETE FROM {files} WHERE nid = %d", $node->nid);
+ module_invoke_all('fileapi', 'delete', $file);
}
function upload_form($node) {
@@ -393,6 +398,7 @@
$result = db_query("SELECT * FROM {files} WHERE nid = %d", $node->nid);
while ($file = db_fetch_object($result)) {
$files[$file->fid] = $file;
+ module_invoke_all('fileapi', 'load', $file);
}
}
as of this writing, upload.module in core must be patched in order to use this module. Use the most recent patch posted to http://drupal.org/node/18934. If that issue is marked 'fixed' or 'closed' you may proceed without patching provided you are using Drupal HEAD or Drupal 4.7. For Drupal 4.6, you do have to patch.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment