250 |
kaklik |
1 |
This directory holds import plugins for phpMyAdmin. Plugin should |
|
|
2 |
basically look like following code. Official plugins need to have str* |
|
|
3 |
messages with their definition in language files, if you build some |
|
|
4 |
plugins for your use, you can use directly texts in plugin. |
|
|
5 |
|
|
|
6 |
<?php |
|
|
7 |
/* $Id: README,v 1.2 2005/09/24 11:41:58 nijel Exp $ */ |
|
|
8 |
// vim: expandtab sw=4 ts=4 sts=4 ft=php: |
|
|
9 |
|
|
|
10 |
/* Demo import plugin for phpMyAdmin */ |
|
|
11 |
|
|
|
12 |
if (isset($import_list)) { |
|
|
13 |
$import_list['name'] = array( // set name of your plugin |
|
|
14 |
'text' => 'strName', // text to be displayed as choice |
|
|
15 |
'extension' => '', // extension this plugin can handle |
|
|
16 |
'options' => array( // array of options for your plugin (optional) |
|
|
17 |
array('type' => '', 'name' => '', 'text' => ''), // type: bool or text, name: form element name, text: description in GUI, size: size of text element (optional). len: maximal size of input (optional) |
|
|
18 |
); |
|
|
19 |
'options_text' => 'strNameImportOptions', // text to describe plugin options (must be set if options are used) |
|
|
20 |
); |
|
|
21 |
} else { |
|
|
22 |
/* We do not define function when plugin is just queried for information above */ |
|
|
23 |
$buffer = ''; |
|
|
24 |
while (!($finished && $i >= $len) && !$error && !$timeout_passed) { |
|
|
25 |
$data = PMA_importGetNextChunk(); |
|
|
26 |
if ($data === FALSE) { |
|
|
27 |
// subtract data we didn't handle yet and stop processing |
|
|
28 |
$offset -= strlen($buffer); |
|
|
29 |
break; |
|
|
30 |
} elseif ($data === TRUE) { |
|
|
31 |
// Handle rest of buffer |
|
|
32 |
} else { |
|
|
33 |
// Append new data to buffer |
|
|
34 |
$buffer .= $data; |
|
|
35 |
} |
|
|
36 |
// PARSE $buffer here, post sql queries using: |
|
|
37 |
PMA_importRunQuery($sql, $verbose_sql_with_comments); |
|
|
38 |
} // End of import loop |
|
|
39 |
// Commit any possible data in buffers |
|
|
40 |
PMA_importRunQuery(); |
|
|
41 |
} |
|
|
42 |
?> |