Record [f:_dev/util/snapshots.php] < dev.sky.1.001
Version 1.001
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 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | <?php defined('START') and AUTH_OK or die; if (START == 'ajax'): $ival or $ival = $PVAL ? $PVAL : $d_snapshot; eval(get("id>1000 and imemo=$ival and code=-1")); switch ($step): case 1: # init; if ($PVAL) { $p_title = 'autosaved'; $n = count(Area::lst('_dev', 'is_file')) + count(Area::lst('_dev/main', 'is_file')) + count(Area::lst('_dev/util', 'is_file')); $ary = ['_dev_codebase' => 'id<1001', '_dev_help' => 1, '_dev_memory' => 'id>9 and id<81']; foreach ($ary as $table => $q) $n += sql("+select count(1) from $table where $q"); $area = [ 'u_inc_p' => 'dev.php _dev', 'u_exc_p' => '_dev/temp', 'u_inc_t' => '_dev_', 'u_exc_t' => '', 'u_inc_r' => '_dev_codebase.-1000 _dev_help.* _dev_memory.10-80', 'u_exc_r' => '', ]; set(['d_snapshot' => $ival] + $area, 0, 2); $area += ['autosaved' => 9 + $n]; } else { area($syn, $area); } $tpl_insert = "insert into _dev_memory values(null, %s, %s, $ival, '%s', %s, now())"; set($area + [ 'step' => 2, 'sid' => $ival, 'start' => START_TS, 'stime' => NOW, 'autosaved' => 0, 'i_dir=i_file=fsize=rsize=size_ar=fcnt=tcnt=rcnt=dcnt' => 0, 'u_svn_skips' => implode(' ', $u_svn_skips), 'u_text_files' => implode(' ', $u_text_files), 'tpl_insert' => $tpl_insert, 'builds' => implode(' ', sql("@select imemo from _dev_memory where id>499 and id<1000 order by id")), ], 0, sql(sprintf($tpl_insert, -1, -1, $p_title, "'#php:\\n'"))); //if (!$syn) .. $log = "1. Snapshot ID=$ival started!"; break; case 2: $u_text_files || echo_json("-Fail. \$u_text_files can't be empty", true); $area = @area(); list($dir_list, $skip, $nused, $files2) = filter_path($area->inc_p, $area->exc_p); $log = "2. Saving path structure:\n" . loger($dirs = implode(' ', $dir_list)) . "\n3. Saving files:"; set(['step' => 3, 'dirs' => $dirs, 'skip' => implode(' ', $skip), 'files2' => implode(' ', $files2)]); break; case 3: $dirs = str2ary($dirs); if ($i_dir < count($dirs)) { if ($i_file) $files = str2ary($files); else { $files = is_file($dirs[$i_dir]) ? [$dirs[$i_dir]] : Area::lst($dirs[$i_dir], 'is_file', false, $skip); $ary = ['files' => implode(' ', $files)] + $ary; } if ($i_file < count($files)) { if (!in_array(basename($fn = $files[$i_file++]), $u_svn_skips)) { $err = "\nSnapshot not complete, please <a href=\"?utility=snapshots&id=$sid&delete\">delete it</a>."; if (is_array($file = getfile($fn, $ftype = rectype($fn)))) echo_json("-Fail. $file[0]$err", true); $size = filesize($fn); $log = " $fn"; if ($ftype == 1 && $size > 400) $file = base64_encode(bzcompress($file)); # will compressed text files only sqlf($tpl_insert, $size, $ftype, $fn, escape($file)); $ary += ['fcnt' => ++$fcnt, 'fsize' => $fsize + $size, 'size_ar' => $size_ar + strlen($file)]; } else $log = " $fn " . sprintf(span_r, '- skipped by $u_svn_skips'); } else ++$i_dir and $i_file = 0; } else $ary += ['step' => 4] and $fcnt or $log = loger(); set($ary + ['i_dir' => $i_dir, 'i_file' => $i_file]); break; case 4: $files2 = str2ary($files2); $area = @area(); set([ 'step' => 5, 'files' => '', 'i_dir=i_file' => 0, 'dcnt' => str2cnt(select_dirs($dirs, '!in_array($d, $files2)'), ' '), 'rows' => $rows = implode(' ', filter_rows($area->inc_r, $area->exc_r)), ]); $log = "4. Saving parsed tables rows:\n" . loger($rows); break; case 5: require '_dev/main/diff.php'; $area = @area(); set([ 'step' => 6, 'tables2' => implode(' ', $tables2 = get_tables2(str2ary($rows))), 'tcnt2' => count($add = array_diff($tables2, $tables = filter_tables($area->inc_t, $area->exc_t))), 'tcnt' => count($tables), '' => "\n\$sql = '" . escape(implode(";\n\n", array_map('create_table', array_merge($tables, $add))), "'\\") ."';\n", ]); $log = "5. Saving tables definitions:\n" . loger(implode(' ', $tables)); if ($add) $log .= "\n This tables definitions added automatically:\n" . sprintf(span_r, loger(implode(' ', $add))); $log .= "\n6. Saving rows:"; break; case 6: $rows = str2ary($rows); $i = $total = $total2 = $err = 0; if ($i_dir < count($rows)) { list ($table, $cn, $cp, $where) = explode('.', $rows[$i_dir], 4); $asr = (int)@$dis_records[$table]; if ($asr == -1) $err = 'table skipped automatically by DEV.SKY.'; elseif ($cn) { $q = sql("select * from $table $where order by $cn limit $i_file, $u_row_portion"); while ($r = fetch($q, true)) { if ($asr && $r[$cp] > $asr) { $err = "records with $cn > $asr skipped automatically by DEV.SKY."; break; } $i++; $total += ($size = strlen($ins = make_insert($r))); if ($size > 400) $ins = base64_encode(bzcompress($ins)); $total2 += strlen($ins); sqlf($tpl_insert, $size, 0, "$table.{$r[$cp]}", escape($ins)); } if ($i) $ary += ['rcnt' => $rcnt + $i, 'rsize' => $rsize + $total, 'size_ar' => $size_ar + $total2]; } # else $err = substr(strip_tags(str_replace("\t", ' ', $where)), 1); $i_file = !$err && $i ? $i + $i_file : 0 or $i_dir++; if ($i || $err) { $log = " `$table`: " . ($i ? "$i rows stored, total $total bytes" : ''); if ($err) $log .= sprintf(span_r, $i ? ", $err" : $err); } } else $ary += ['step' => 7] and $rcnt or $log = loger(); set($ary + ['i_dir' => $i_dir, 'i_file' => $i_file]); break; case 7: $start = round(microtime(true) - $start, 3); $fsize += $rsize; $rsize = "$fsize compressed to $size_ar"; $size_ar = $fsize ? round($size_ar / $fsize * 100, 1) : 0; $tcnt += $tcnt2; $x = "FTRD: A^<u>$fcnt/$tcnt/$rcnt/$dcnt</u>"; $log = "+7. Done. Time left: <u>$start seconds</u>. $x. Total: <u>$rsize bytes</u>, ratio: <u>$size_ar%</u>."; break; endswitch; if (1 != $step && PAGE == 'ini') $log = "-Failed. Snapshot ID=$ival already exists!"; if (1 < $step && $autosaved) $autosaved = "Stored " . ($fcnt + $tcnt + $rcnt + $dcnt) . " objects of $autosaved"; echo_json($log); elseif ($WHAT == 'new'): # HTML PAGE ////////////////////////////// ADD NEW SNAPSHOT ///////////////////////////////////////////////// $id = sql("+select ifnull(max(imemo) + 1, 1) from _dev_memory where id>1000"); $TOP = ' > Create new snapshot'; ?><form id="f1"> <p>Snapshot name or comment: <input name="title" style="width:50%" /> <p><? require '_dev/main/area.php' ?><p> <input type="button" value="Do new snapshot ID=<?=$id?> - F9" onclick="key_F9()" /> </form> <pre id="log"></pre> <script type="text/javascript"> var f1 = $('f1'); var r = 'This operation will memorize you project files and SQL tables data in the table _dev_memory.<br>'; mtop(r + 'You can use this snapshot later (after work) to find changes and automaticaly build deploy `DEV` script'); function key_F9() { if (f1.inc_p.value.match(/\*/)) return mtop('`*` chars not allowed in `include paths` area', red); cycle('&ini=0&title=' + e$(f1.title.value) + qs_area(), 'Creating Snapshot', false, <?=$id?>); } </script><?php ////////////////////////////// SELECTED SNAPSHOT ID ///////////////////////////////////////////// elseif ($WHAT == 'id' and $r = sql("-select cmemo, tmemo, dt from _dev_memory where id>1000 and imemo=$WVAL and code=-1")): if (isset($g_restore)) { list($size, $name, $file, $ftype) = sql("-select title, cmemo, tmemo, code from _dev_memory where id=$g_restore"); if ($ftype > 1) $file = base64_decode($file); elseif ($size > 400) $file = bzdecompress(base64_decode($file)); file_put_contents($name, $file); } list($title, $tmemo, $dt) = $r; eval($tmemo); $area = @area(); $u_text_files = str2ary($u_text_files); $u_svn_skips = str2ary($u_svn_skips); $old_dirs = str2ary($dirs); isset($g_wt) or $g_wt = ''; $input_code = 'type="radio" name="wt" onclick="document.location.href=\'?utility=snapshots&id='."$WVAL&wt='+this.value\""; $ic1 = $g_wt == 'rows' ? ' checked' : ''; $ic2 = $g_wt == 'files' ? ' checked' : ''; $ic3 = !$g_wt ? ' checked' : ''; $TOP = " > ID=$WVAL, from $dt" . ($title ? ", $title" : '') . " > "; $TOP .= a('create script - F9', $scripts = "?utility=scripts&id=$WVAL", 'class="nd"'); ?> <form method="post" id="f1" action="?utility=snapshots"><input type="hidden" name="s[]" value="<?=$WVAL?>" /></form> <fieldset style="background:#eee"><legend>What to show:</legend> <label style="float:right"><input <?=$input_code.$ic1?> value="rows"> rows only<?=pad(5)?></label> <label style="float:right"><input <?=$input_code.$ic2?> value="files"> files only<?=pad(1)?></label> <label style="float:right"><input <?=$input_code.$ic3?> value=""> all<?=pad(1)?></label> <label><input type="checkbox"<?=isset($g_all)?' checked':''?> onclick="document.location.href='?utility=snapshots&id=<?=$WVAL?>'+(this.checked?'&all':'')+'&wt=<?=$g_wt?>'" /> files and rows which is not changed</label></fieldset> <h3>File comparing based on filesize (not exact):</h3> <div style="margin:-15px 0 10px 0;font-size:smaller">NOTE: for script creation will used exact comparing.<br></div> Include paths: <?=$u_inc_p?><br> Exclude paths: <?=$u_exc_p?><br> Total files stored: <?=$fcnt?>, Total bytes: <?=$fsize?>, Total path definitions stored: <?=count($old_dirs)?><br> <hr> <script type="text/javascript"> function key_F9() { location.href = '<?=$scripts?>'; } function restore(v, id) { var y = '<input type="button" value="yes" onclick="document.location.href=\'?utility=snapshots&id=<?=$WVAL?>&restore=' + id + '\'" /> '; var q = v ? 'This <span style="color:red">will destroy</span> all last changes you do with this file!' : 'Currently file absent in project.'; mtop('<div style="float:right">' + y + button_no + '</div>Are you sure you want to restore file?<br>' + q); } <?php if (isset($g_delete)): ?>mtop('Snapshot will deleted in 3 seconds...', red); setTimeout('f1.submit()', 3000);<?php endif ?> </script> <?php $scr = '<span class="red"> ! </span>'; $scg = '<span class="green"> ! </span>'; $scy = '<span class="yellow"> ! </span>'; $row_t = 0; function echo_row($right, $left) { echo '<div style="border-bottom:1px solid silver;padding-bottom:2px"> <div style="float:right;width:30%">' . "$right</div>$left" . '</div><div style="clear:both;font-size:0;height:0"></div>'; global $row_t, $row_i; ++$row_t; ++$row_i; } if ($show_block = !$g_wt || $g_wt == 'files'): # EXECUTE BLOCK FILES list($dir_list, $skip, $nused, ) = filter_path($area->inc_p, $area->exc_p); $add_dirs = array_diff($dir_list, $old_dirs); $del_dirs = array_flip(array_diff($old_dirs, $dir_list)) and $del_dirs[key($del_dirs)] = 1; $dir_list = array_flip(array_diff($dir_list, $add_dirs)) and $dir_list[key($dir_list)] = 1; $row_i = 0; foreach ($add_dirs as $dir) if ($row_t > $u_max_fly_exec) break; else is_dir($dir) ? echo_row("directory added $scg", "dir:$dir (+" . count(Area::lst($dir, 'is_file')) . ' files inside)') : echo_row("file added $scg", $dir . sprintf(span_g, ' ' . filesize($dir) . ' bytes')); $q = sql("select id, title, cmemo, code from _dev_memory where id>1000 and imemo=$WVAL and code>0 order by id"); $files = []; $pp = $end = ''; $collect = 0; while (!$end && $row_t <= $u_max_fly_exec) { if (eval(fetch)) $p = ($p = strrpos($r_cmemo, '/')) ? substr($r_cmemo, 0, $p) : '.'; else $p = ''; if ($pp != $p) { foreach ($files as $file => $v) if ($row_t > $u_max_fly_exec) break; else $v && echo_row("file added $scg", $file . sprintf(span_g, ' ' . filesize($file) . ' bytes')); if ($collect) { echo_row("directory deleted $scr", "dir:$pp (+$collect files inside)"); $del_dirs[$pp] = 0; } $pp = $p; $collect = 0; if (isset($dir_list[$p])) { $files = array_flip(Area::lst($p, 'is_file', false, $skip)) and $files[key($files)] = 1; $dir_list[$p] = 0; } else $files = []; } $col = ''; if ($r) { $exists = is_file($r_cmemo); $size = $exists ? filesize($r_cmemo) : 0; if ($r_code == 1) $type = ''; else $type = $r_code == 2 ? 'blueviolet">(image)' : 'magenta">(binary)'; isset($files[$r_cmemo]) and $files[$r_cmemo] = 0; if (!$exists) { # FILE DELETED if (isset($del_dirs[$p])) $collect++; else { $right = ($type ? 'file deleted ' : '<a href="?utility=compare&cf=' . $r_id . '" class="nd">file deleted</a> ') . $scr . ' <a href="#top" onclick="restore(0,' . $r_id . ')" class="nd">restore file</a>'; $col = 'red'; } } elseif ($r_title == $size) $right = 'size identical'; else { # SIZE CHANGED! $right = "size differ $scy" . ' <a href="#top" onclick="restore(1,' . $r_id . ')" class="nd">restore file</a>'; if ($r_code == 1) $r_cmemo = '<a href="?utility=compare&cf=' . $r_id . '" class="nd">' . $r_cmemo . '</a>'; $r_title = "<span style=\"background:#ffa\">$size, $r_title</span>"; } if ($collect || $r_title == $size && !isset($g_all)) ++$row_t; else echo_row($right, "$r_cmemo <span style=\"color:$col\">$r_title bytes</span> <span style=\"color:$type</span>"); } else $end = true; } foreach ($dir_list as $dir => $v) if ($v && is_dir($dir)) foreach (Area::lst($dir, 'is_file', false, $skip) as $file) if ($row_t > $u_max_fly_exec) break 2; else echo_row("file added $scg", $file . sprintf(span_g, ' ' . filesize($file) . ' bytes')); foreach ($del_dirs as $dir => $v) if ($row_t > $u_max_fly_exec) break; else $v && is_dir($dir) && echo_row("directory deleted $scr", "dir:$dir (0 files inside)"); endif; # EXECUTE BLOCK $message_tpl = '<div style="height:30px;padding-top:12px;text-align:center;background:%s;">%s</div>'; $nothing_changed = sprintf($message_tpl, '#7f7', 'It seems nothing changed since Snapshot stored!'); $not_stored = sprintf($message_tpl, 'yellow', '%s are not stored in this Snapshot!'); $too_big_processing = sprintf($message_tpl, 'pink', 'Execution terminated! Too big processing on the fly!'); $execution_skipped = sprintf($message_tpl, 'skyblue', 'Execution of the block is skipped'); if (!$show_block) echo $execution_skipped; elseif ($row_t > $u_max_fly_exec) echo $too_big_processing; elseif (!$row_i) echo $fcnt ? $nothing_changed : sprintf($not_stored, 'Files'); // ------------------------------------------------------------------------------------------------------ $compare = '<a href="?utility=compare&db=' . $WVAL . '" class="nd">%s</a>'; $right_tpl = $compare . ' %s <a class="nd" href="?utility=sql_query%s">%s</a>'; $pcs = sprintf($compare, $tcnt2 ? $tcnt . sprintf(span_r, "+$tcnt2") . ' pcs' : "$tcnt pcs"); echo "<h3>Comparing SQL tables structure (exact):</h3> Include prefix: $u_inc_t<br> Exclude prefix: $u_exc_t<br> Total table definitions stored: " . ($tcnt + $tcnt2 ? $pcs : 0) . "<hr>"; require '_dev/main/diff.php'; # TABLES STRUCTURE BLOCK ALWAYS WORK! $tables = compare_tables($area->inc_t, $area->exc_t, $tables2 = str2ary($tables2), $sql); $row_i = 0; foreach ($tables as $table => $data) { if (is_string($data)) $right = 'structure identical'; elseif (1 === $data) $right = sprintf($right_tpl, 'table added', $scg, "&td=$WVAL.$table.", 'drop table'); elseif (0 === $data) $right = sprintf($right_tpl, 'table deleted', $scr, "&tc=$WVAL.$table.", 'create table'); else $right = sprintf($right_tpl, 'structure differ', $scy, "&ta=$WVAL.$table.", 'alter table back'); if (!is_string($data) || isset($g_all)) echo_row($right, "table:$table"); } if (!$row_i) echo $tcnt + $tcnt2 ? $nothing_changed : sprintf($not_stored, 'Tables structure'); // ------------------------------------------------------------------------------------------------------ echo '<h3>Comparing SQL tables data rows (not exact):</h3> <div style="margin:-15px 0 15px 0;font-size:smaller">NOTE: Comparing based on row size. For script creation will used exact comparing.</div>' . " Include rows: $u_inc_r<br> Exclude rows: $u_exc_r<br> Total table's rows stored: $rcnt, Total bytes: $rsize<hr>"; $compare = 'row:<a href="?utility=compare&cr=%%s.." class="nd">%%s</a>, %s <span style="background:#ffa">%%s</span> bytes'; $row_i = 0; if ($show_block = !$g_wt || $g_wt == 'rows'): # EXECUTE BLOCK ROWS $sid && sql("update _dev_memory set cmemo=mid(cmemo,2) where id>1000 and imemo=$sid and code=0 and left(cmemo,1)='.'"); # clear marks if ($row_t <= $u_max_fly_exec) foreach (filter_rows($area->inc_r, $area->exc_r) as $def) { list ($table, $cn, $cp, $where) = explode('.', $def, 4); $asr = (int)@$dis_records[$table]; if (!$cn) continue; $len = strlen("$table."); $from_memory = "from _dev_memory where id>1000 and imemo=$WVAL and code=0 and left(cmemo,$len)='$table.'"; if (-1 == $asr || !is_string($tables[$table])) { $out = ''; if (-1 == $asr) $out = "all rows automatically excluded!"; elseif (1 == $tables[$table]) $n = sql("+select count(1) from $table") and $out = "$n rows added to new table!"; else $n = sql("+select count(1) $from_memory") and $out = "$n rows stored with other structure!"; $tables[$table] = 2; # mark passed! if ($out) echo_row($scr, "table:$table - " . sprintf(span_r, $out)); else ++$row_t; continue; } $tables[$table] = 2; # mark passed! # $q = sql("select title, id, substr(cmemo, 1 + $len) $from_memory limit " . ($u_max_fly_exec - $row_t + 1)); # for ($ary = []; $r = fetch($q); ) $ary[$r[2]] = [$r[0], $r[1]]; replaced with: !!! 2check $ary = sql("@select substr(cmemo, 1 + $len), title, id $from_memory limit " . ($u_max_fly_exec - $row_t + 1)); if ($row_t + count($ary) > $u_max_fly_exec) { $row_t += count($ary); break; } $size_differ = "size differ $scy" . ' <a href="?utility=sql_query&ru=' . "$WVAL.$table.%s." . '" class="nd">update row</a>'; $row_added = "row added $scg" . ' <a href="?utility=sql_query&rd=' . "$WVAL.$table.%s" . '" class="nd">delete row</a>'; $row_deleted = "row deleted $scr" . ' <a href="?utility=sql_query&ri=' . "$WVAL.$table.%s" . '" class="nd">insert row</a>'; list($cp2, $column) = find_column($table); $comp2 = sprintf($compare, "cell:<a href=\"?utility=compare&cr=%1\$s.$cp2.$column\" class=\"nd\">$column</a>"); $q = sql("select * from $table $where order by $cn"); while ($r = fetch($q, true)) { if ($row_t > $u_max_fly_exec) break 2; $id = $r[$cp]; if ($asr && $id > $asr) break; $row_def = "$table.$id"; $new = strlen(make_insert($r)); if (isset($ary[$id])) { list($size, $id_mem) = $ary[$id]; $ary[$id] = 0; # compared mark! if ($size == $new) isset($g_all) && echo_row('size identical', "row:$row_def $size bytes"); else echo_row(sprintf($size_differ, "$id.$cn.$id_mem"), sprintf($comp2, "$id_mem.$cn", $row_def, "$new, $size")); } else echo_row(sprintf($row_added, "$id.$cn"), "row:$row_def " . sprintf(span_g, "$new bytes")); } foreach($ary as $id => $mem) if ($row_t > $u_max_fly_exec) break 2; else $mem && echo_row(sprintf($row_deleted, $mem[1]), "row:$table.$id " . sprintf(span_r, "$mem[0] bytes")); } foreach ($tables as $table => $pas) if (2 !== $pas && in_array($table, $tables2)) { if ($row_t > $u_max_fly_exec) break; $len = strlen("$table."); $n = sql("+select count(1) from _dev_memory where id>1000 and imemo=$WVAL and code=0 and left(cmemo,$len)='$table.'"); if ($n) echo_row($scr, "table:$table - " . sprintf(span_r, "$n rows stored from deleted table")); else ++$row_t; } endif; # EXECUTE BLOCK if (!$show_block) echo $execution_skipped; elseif ($row_t > $u_max_fly_exec) echo $too_big_processing; elseif (!$row_i) echo $rcnt ? $nothing_changed : sprintf($not_stored, 'Data rows'); else ;;; elseif ($WHAT == 'id'): echo js("mtop('Snapshot not found', red)"); ////////////////////////////// SNAPSHOT LIST //////////////////////////////////////////////////// else: if (isset($p_s)) sqlf("delete from _dev_memory where id>1000 and imemo in (%s)", $p_s); $i = $j = 0 ?><form method="post" name="form1"><?php $q = sql("select * from _dev_memory where id>1000 and code=-1 order by imemo desc"); while (eval(fetch)) { eval($r_tmemo); $r_title = strtr($r_title, ['"' => '"']); if ($tcnt2) $tcnt .= sprintf(span_r, "+$tcnt2"); $id = pad00($r_imemo); $expl = 'Added Files, Tables, Rows, Dirs'; $comm = $r_cmemo ? ' ' . substr($r_cmemo, 0, 25) . ' ...' : ''; $wt = $fcnt + $tcnt + $tcnt2 + $rcnt < 300 ? '' : ($fcnt ? '&wt=files' : '&wt=rows'); $inp = 0&&$autosaved ? '' : "<input type=\"checkbox\" name=\"s[]\" value=\"$r_imemo\" style=\"margin-top:-3px;height:16px\" />"; #? echo <<<DOC <div style="border-bottom:1px solid silver;padding-bottom:2px"> <div style="float:right"> <a href="?utility=scripts&id=$r_imemo" class="nd">create script</a> <a href="javascript:expl($r_imemo)" class="nd">explode to temp</a> $inp </div> ID=$id <a href="?utility=snapshots&id=$r_imemo$wt" class="nd" title="$expl">$r_dt FTRD: A^$fcnt/$tcnt/$rcnt/$dcnt</a>$comm </div><div style="clear:both"></div> DOC; $i++; unset($fcnt, $tcnt, $tcnt2, $rcnt, $dcnt, $autosaved); if ($d_snapshot > 0 && $d_snapshot == $r_imemo) $j = 1; } if ($d_snapshot > 0 && !$j) set('d_snapshot', 0); if ($i): ?><div style="width:100%;height:10px"></div> <div style="float:right"><input type="button" value="delete checked" onclick="delete_checked()" /></div> <script type="text/javascript"> function delete_checked() { var r = '<div style="float:right"><input onclick="document.form1.submit()" type="button" value="yes" /> ' + button_no + '</div>'; mtop(r + 'This will delete checked Snapshots!<br>Are you sure you want to delete?'); document.location.href = '#top'; } function expl(id) { var r = '<div style="float:right"><input onclick="document.location.href=\'?utility=export&explode=' + id + '\'" type="button" value="yes" /> '; mtop(r + button_no + '</div>This operation erase `temp` directory & explode Snapshot ID=' + id + ' to it!<br>Continue?'); document.location.href = '#top'; } mtop('List of stored Snapshots:', green) </script> <?php else: ?><script type="text/javascript">mtop('No Snapshots found!')</script><?php endif ?> <div style="float:right"><a href="?utility=scripts&id=0">create script from Scratch</a> </div> <input type="button" value="new snapshot" onclick="document.location.href='?utility=snapshots&new'" /> <?php if (!$i): ?><div style="padding:10px;background:#7f7;margin-top:10px">Store your files, dirs, tables structure and rows in Snapshot.<br> Use this Snapshot later (after work done) for automated creation of script of your changes.</div><?php endif ?> </form> <?php #.delchk {position:relative; top: 2px; margin:0; } endif; # SNAPSHOT LIST |
Codebase entries (89)
SKY. status
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