} $other = mlang_component::from_snapshot($componentname, $otherlang, $version, null, true, false, array($string->id)); if ($other->has_string($string->id)) { $current = $other->get_string($string->id); if (!$current->deleted) { $current->deleted = true; $current->timemodified = time(); $stage->add($other); } } $other->clear(); unset($other); } $stage->rebase(); if ($stage->has_component()) { $string->timemodified = local_amos_renderer::commit_datetime($string->timemodified); $msg = <<<EOF Propagating removal of the string The string '{$string->id}' was removed from the English language pack by {$string->extra->userinfo} at {$string->timemodified}. Their commit message was: {$string->extra->commitmsg} {$string->extra->commithash} EOF; fputs(STDOUT, "COMMIT removal of '{$string->id}' from '{$english->name}'\n"); $stage->commit($msg, array('source' => 'revclean', 'userinfo' => 'AMOS-bot <*****@*****.**>'), true); } $stage->clear(); unset($stage); } }
if (!$results) { print_error('invalidtimelineparams', 'local_amos'); } $table = new html_table(); $table->attributes['class'] = 'timelinetable'; foreach ($results as $result) { $encell = new html_table_cell(); $langcell = new html_table_cell(); if ($result->lang == 'en') { $cell = $encell; $none = $langcell; } else { $cell = $langcell; $none = $encell; } $date = html_writer::tag('div', local_amos_renderer::commit_datetime($result->timemodified), array('class' => 'timemodified')); $userinfo = html_writer::tag('span', s($result->userinfo), array('class' => 'userinfo')); $commitmsg = html_writer::tag('span', s($result->commitmsg), array('class' => 'commitmsg')); if ($result->deleted) { $text = html_writer::tag('del', s($result->text)); } else { $text = s($result->text); } $text = local_amos_renderer::add_breaks($text); if ($result->commithash) { if ($result->lang == 'en') { $url = 'https://github.com/moodle/moodle/commit/' . $result->commithash; } else { $url = 'https://github.com/mudrd8mz/moodle-lang/commit/' . $result->commithash; } $hashlink = html_writer::link($url, $result->commithash);
$mem = memory_get_usage(); $memdiff = $memprev < $mem ? '+' : '-'; $memdiff = $memdiff . abs($mem - $memprev); fputs(STDOUT, "FOUND {$commithash} {$changetype} {$file} [{$mem} {$memdiff}]\n"); // get some additional information of the commit $format = implode('%n', array('%an', '%ae', '%at', '%s', '%b')); // name, email, timestamp, subject, body $commitinfo = array(); $gitcmd = AMOS_PATH_GIT . " log --format={$format} {$commithash} ^{$commithash}~"; exec($gitcmd, $commitinfo); $committer = $commitinfo[0]; $committeremail = $commitinfo[1]; $realmodified = $commitinfo[2]; // the real timestamp of the commit - should be the same as $committime $commitmsg = iconv('UTF-8', 'UTF-8//IGNORE', $commitinfo[3]); $commitmsg .= "\n\nCommitted into Git: " . local_amos_renderer::commit_datetime($realmodified); $fullcommitmsg = implode("\n", array_slice($commitinfo, 3)); // AMOS script is looked up here later if ($changetype == 'D') { // whole file removal - do not do anything, fix-drift job will clear the repository continue; } // get the list of strings affected by the commit $gitcmd = AMOS_PATH_GIT . " log -1 -p --format=format: " . $commithash . ' -- ' . $file; $diff = array(); exec($gitcmd, $diff); foreach (mlang_tools::get_affected_strings($diff) as $stringid) { $affected[$componentname][$stringid] = true; } // dump the given revision of the file to a temporary area $checkout = $commithash . '_' . str_replace('/', '_', $file);