source: trunk/junk/attach-dos2unix @ 1184

Revision 852, 746 bytes checked in by cdleonard@…, 4 years ago (diff)

svn:eol-style native in trunk. Also svn:executable on all scripts

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#! /usr/bin/env php
2<?php
3// This script is used to repair all text attachments that weren't in Linux format.
4
5require_once(dirname($argv[0]) . "/utilities.php");
6require_once(IA_ROOT_DIR."common/attachment.php");
7require_once(IA_ROOT_DIR."common/db/attachment.php");
8
9ini_set("memory_limit", "128M");
10
11db_connect();
12$query = "SELECT * FROM ia_file;";
13$attachments = db_fetch_all($query);
14$fixed = 0;
15
16log_print("Exista ".count($attachments)." atasamente...");
17foreach ($attachments as $attach) {
18    if (!is_textfile($attach['mime_type'])) {
19        continue;
20    }
21    log_print('Repar '.$attach['page'].'\\'.$attach['name']);
22    dos_to_unix(attachment_get_filepath($attach));
23    $fixed++;
24}
25log_print("S-au reparat ".$fixed." atasamente!");
Note: See TracBrowser for help on using the repository browser.