Запись [f:_dev/util/tune.php] < dev.sky.1.001
Версия 1.000
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 | <?php defined('START') and AUTH_OK or die; if (START == 'ajax'): if ('ini' == PAGE) { $dev_rule = "id < 10001 or id = 50000"; if ($ival) { # just package $log = ''; $rule = 1 == $ival ? $dev_rule : "package_id=$ival"; $ary = ['rule' => $rule, 'rn' => $PVAL ? 2 : 0, 'php' => (int)$p_php, 'fam' => (int)$p_fam]; } else { # interval of records $log = "Records syntax checking...\n"; $v = $PVAL[0]; $PVAL = substr($PVAL, 1); if (1 == $v && 1 == $PVAL || 3 == $v) $rule = $dev_rule; else $rule = 2 == $v ? where_rule(list_imp($PVAL, 3)) : "package_id=$PVAL"; $ary = ['rule' => $rule, 'php=rn' => $p_php = $p_ns = 0, 'fam' => 1]; } set($ary + ['cnt=start=psize' => 0, 'ival' => $ival, 'ns' => (int)($p_php ? 0 : $p_ns)]); $log .= sprintf('Tune %s started.', $ival ? 'package `' . cell($ival, 'p', 'name') . '`' : "`$rule`"); } else { eval(get()); # 2do: update `author` column ? + package values! if ($rec = Record::tune("$rule order by id limit $start, 1", $rn, $php, $fam)) { if ($rec->ary) sqlf("update _dev_codebase set %s, dt_upd=now(), changed=1 where id=$rec->id", $rec->ary); foreach ($rec->mess as $mess) { $cnr = substr($mess, -11) == 'cannot read'; if (2 == $ns && $cnr) continue; else $log .= "\n " . ($mess[0] == '+' ? sprintf(span_g, substr($mess, 1)) : sprintf($cnr ? span_b : span_r, $mess)); } if ($log || !$ns) $log = pad00(++$cnt) . ". ID=$rec->id $rec->name$log" . ($log ? '' : sprintf(span_g, ' - OK')); if (Record::$err && !$ival) echo_json("-$log. Stop.", true); set(['start' => ++$start, 'cnt' => $cnt, 'psize' => $psize + $rec->size]); } else { $log = "+Tune done. Records count: $start, total size: $psize bytes"; } } echo_json($log); else: # HTML PAGE TUNE $packages = "select id, concat(name,if('.'=right(name,1),'','.'),version) from _dev_packages order by 1"; ?><form id="f1"> Select Package: <select name="pack"><?=option(1, $packages)?></select> <span class="pop" id="pop_rectangle">?</span> <br><br> <label><input type="checkbox" name="php" /> Check PHP syntax for php files <span class="pop" id="pop_php">?</span></label><br> <label><input type="checkbox" name="renew" checked /> Renew files</label><br> <label><input type="checkbox" name="fam" /> Fix parents-childs links</label><br> <br><fieldset style="background:#eee"><legend>What to show in log:</legend> <label><input type="radio" onclick="f1.ns.value=this.value" name="nsh" value="0" /> show all</label><br> <label><input type="radio" onclick="f1.ns.value=this.value" name="nsh" value="1" /> do not show log records without errors and changes</label><br> <label><input type="radio" onclick="f1.ns.value=this.value" name="nsh" value="2" checked /> do not show errors ".. not exists or cannot read"</label> </fieldset><br> <input type="hidden" name="ns" value="2" /> <input type="button" value="Tune - F9" onclick="key_F9()" /> <? if ($u_profile_code == 1): echo pad() ?> <input type="button" value="move Records" onclick="document.location.href='?utility=move'" /><? endif ?> </form> <pre id="log"></pre> <script type="text/javascript"> var f1 = $('f1'); mtop('<u>This Utility can do with Codebase records folowing work:</u><br>' + '1) Check codebase syntax (+ may be PHP syntax)<br>' + '2) Renew (update) Codebase records from appropriate files (for WRITE FILE: commands)<br>' + '3) Fix EOL for CB records with \\n only - Unix type EOLs<br>' + '4) Replace spaces with tab at the begining of lines (if record allowed)<br>' + '5) Set for CB records ID >= 1 and ID <= 10000 dev.sky. Package, ID = 1<br>' + '6) Check UTF-8 encoding for text files<br>' + '7) Fix parents-childs links, set error status for broken records' ); function key_F9() { var v = (f1.renew.checked ? 1 : 0) + '&ns=' + f1.ns.value + '&php=' + (f1.php.checked ? 1 : 0) + '&fam=' + (f1.fam.checked ? 1 : 0); cycle(f1.pack.value + '&ini=' + v, 'Tune'); } </script> <?php endif; |
Записи Codebase (89)
Статус SKY.
Current version: 1.001
Coresky records: 22
Local (DEV) records: 89
Web (all) records: 105
Download: dev.php
Coresky records: 22
Local (DEV) records: 89
Web (all) records: 105
Download: dev.php