Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 08:45 pm EST
Geeklog Forums
Script for easyfile plugin..
Astalas
Anonymous
I dunno if any of you have used the easyfile plugin in the past.. but if you did and then later wanted to go with a different filemanager then you probably discovered all your files are being stored as an Octstream. They still work with a different filemanager but the name is all crazy numbers based on date, ect.. blah.. blah..
Anyways heres a simple script that will restore he original names. Just had to crap it out a bit ago so I thought I'd toss it here. If anyone has a better place for this post.. feel free to relocate it there.
<?php
// Config
$dbhost = "localhost";
$dbuser = "XXXX";
$dbpass = "XXXX";
$dbname = "XXXXXX";
$path = "/path/to/files"; // No trailing slash!
mysql_connect("$dbhost", "$dbuser", "$dbpass" or die(mysql_error());
mysql_select_db("$dbname" or die(mysql_error());
$query = mysql_query("select fileid, filename from gl_easyfile"
while($row = mysql_fetch_array($query)){
$fileid= $row['fileid'];
$filename = $row['filename'];
echo "Working with $fileid --\n";
$x = rename("$path/$fileid","$path/$filename"
if($x==true){
echo "$filename renamed successfully./n";
}else{
echo "Something bad happened. Files not renamed.";
}
}
?>
Anyways heres a simple script that will restore he original names. Just had to crap it out a bit ago so I thought I'd toss it here. If anyone has a better place for this post.. feel free to relocate it there.
<?php
// Config
$dbhost = "localhost";
$dbuser = "XXXX";
$dbpass = "XXXX";
$dbname = "XXXXXX";
$path = "/path/to/files"; // No trailing slash!
mysql_connect("$dbhost", "$dbuser", "$dbpass" or die(mysql_error());
mysql_select_db("$dbname" or die(mysql_error());
$query = mysql_query("select fileid, filename from gl_easyfile"
while($row = mysql_fetch_array($query)){
$fileid= $row['fileid'];
$filename = $row['filename'];
echo "Working with $fileid --\n";
$x = rename("$path/$fileid","$path/$filename"
if($x==true){
echo "$filename renamed successfully./n";
}else{
echo "Something bad happened. Files not renamed.";
}
}
?>
16
11
Quote
Status: offline
::Ben
Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
:doh: Yes I made a search on easyfile plugin
To much informations hide information
Thank you Dirk.
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
To much informations hide information
Thank you Dirk.
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
8
8
Quote
All times are EST. The time is now 08:45 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content