How to use run method of merge_results class

Best Phoronix-test-suite code snippet using merge_results.run

users.inc

Source:users.inc Github

copy

Full Screen

...33}34function _lookup_user($criteria, $single_result = false, $fields = array())35{36 $sql = "SELECT * FROM `Members` WHERE $criteria;";37 $result = DB::run($sql);38 if ($single_result && $result->rowCount() > 1) {39 return array('code' => '409 Conflict', 'users' => array());40 }41 $value = $result->fetch();42 if ($value === false) {43 return array('code' => '404 Not Found', 'users' => array());44 }45 $output = ['code' => null, 'users' => array()];46 while ($value !== false) {47 $user = _parse_user($value, $fields);48 array_push($output['users'], $user);49 $value = $result->fetch();50 }51 return $output;52}53function lookup_users_by_ids($ids, $fields = array())54{55 if (\ciab\CRM::active()) {56 return \ciab\CRM::lookupUsersByIds($ids, false, $fields);57 }58 $str = implode(", ", $ids);59 return _lookup_user("AccountId IN ($str)", false, $fields);60}61function lookup_user_by_id($id, $fields = array())62{63 $id = trim($id);64 if (\ciab\CRM::active()) {65 return \ciab\CRM::lookupUsersByIds($id, true, $fields);66 }67 return _lookup_user("AccountID = $id", true, $fields);68}69function lookup_users_by_email($email, $single = true, $substring = false, $fields = array())70{71 $email = trim($email);72 if (\ciab\CRM::active()) {73 return \ciab\CRM::lookupUsersByEmail($email, $single, $substring, $fields);74 }75 if ($substring) {76 return _lookup_user("Email LIKE '%$email%'", $single, $fields);77 } else {78 return _lookup_user("Email = '$email'", $single, $fields);79 }80}81$_set = array();82function filter_users($user)83{84 global $_set;85 if (in_array($user['Id'], $_set)) {86 return false;87 } else {88 $_set[] = $user['Id'];89 return true;90 }91}92function sort_users($a, $b)93{94 return intval($a['Id']) > intval($b['Id']);95}96function merge_results($result1, $result2)97{98 global $_set;99 $_set = array();100 $output = ['code' => '404 Not Found', 'users' => array()];101 if ($result1['code'] === null) {102 $output['code'] = null;103 $output['users'] = array_merge($output['users'], $result1['users']);104 foreach ($result1['users'] as $u) {105 $_set[] = $u['Id'];106 }107 }108 if ($result2['code'] === null) {109 if ($output['code'] === null) {110 $result = array_filter($result2['users'], 'filter_users');111 } else {112 $result = $result2['users'];113 $output['code'] = null;114 }115 $output['users'] = array_merge($output['users'], $result);116 }117 usort($output['users'], "sort_users");118 return $output;119}120function lookup_users_by_name($name, $single = false, $substring = false, $fields = array())121{122 $name = trim(preg_replace('/\s+/', ' ', $name));123 if (\ciab\CRM::active()) {124 return \ciab\CRM::lookupUsersByName($name, $single, $substring, false, $fields);125 }126 $names = explode(" ", $name);127 $i2 = 1;128 if (count($names) < 2) {129 $i2 = 0;130 }131 if ($substring) {132 $query = "FirstName LIKE '%".$names[0]."%' OR LastName LIKE '%".$names[$i2]."%'";133 } elseif ($i2 > 0) {134 $query = "FirstName = '$names[0]' AND LastName = '$names[1]'";135 } else {136 return array('code' => '404 Not Found', 'users' => array());137 }138 return _lookup_user($query, $single, $fields);139}140function lookup_users_by_pref_name($name, $single = false, $substring = false, $fields = array())141{142 $name = trim(preg_replace('/\s+/', ' ', $name));143 if (\ciab\CRM::active()) {144 return \ciab\CRM::lookupUsersByName($name, $single, $substring, true, $fields);145 }146 $names = explode(" ", $name);147 $i2 = 1;148 if (count($names) < 2) {149 $i2 = 0;150 }151 if ($substring) {152 if (count($names) < 2) {153 $query = <<<Q154 (PreferredFirstName LIKE '%$name%' OR155 PreferredLastName LIKE '%$name%' OR156 LastName LIKE '%$name%' OR157 FirstName LIKE '%$name%')158Q;159 } else {160 $query = <<<Q161 (PreferredFirstName = '$names[0]' AND PreferredLastName LIKE '%$names[1]%') OR162 (PreferredFirstName = '$names[0]' AND LastName LIKE '%$names[1]%') OR163 (FirstName = '$names[0]' AND PreferredLastName LIKE '%$names[1]%')164 (PreferredFirstName LIKE '%$names[0]%' AND PreferredLastName = '$names[1]') OR165 (PreferredFirstName LIKE '%$names[0]%' AND LastName = '$names[1]') OR166 (FirstName LIKE '%$names[0]%' AND PreferredLastName = '$names[1]')167Q;168 }169 } elseif ($i2 > 0) {170 $query = <<<Q171 (PreferredFirstName = '$names[0]' AND PreferredLastName = '$names[1]') OR172 (PreferredFirstName = '$names[0]' AND LastName = '$names[1]') OR173 (FirstName = '$names[0]' AND PreferredLastName = '$names[1]')174Q;175 } else {176 return array('code' => '404 Not Found', 'users' => array());177 }178 return _lookup_user($query, $single, $fields);179}180function lookup_users_by_badgename(181 $badge,182 $single_user = false,183 $substring = false,184 $fields = array()185) {186 $badge = trim($badge);187 if ($substring) {188 $sql = <<<SQL189 SELECT190 AccountID191 FROM192 `Registrations`193 WHERE194 BadgeName LIKE '%{$badge}%'195SQL;196 } else {197 $sql = <<<SQL198 SELECT199 AccountID200 FROM201 `Registrations`202 WHERE203 BadgeName = '$badge'204SQL;205 }206 return _lookup_user("AccountID IN ($sql)", $single_user, $fields);207}208function lookup_users_by_key($key, $single = true, $badgename = true, $substring = false, $fields = array())209{210 $key = trim(preg_replace('/\s+/', ' ', $key));211 if ($substring) {212 $output = ['code' => '404 Not Found', 'users' => array()];213 if (is_numeric($key) ||214 (strtoupper($key)[0] == 'A' && is_numeric(substr($key, 1)))) {215 if (strtoupper($key)[0] == 'A') {216 $result = lookup_user_by_id(substr($key, 1), $fields);217 $output = merge_results($output, $result);218 } else {219 $result = lookup_user_by_id($key, $fields);220 $output = merge_results($output, $result);221 }222 }223 $result = lookup_users_by_email($key, $single, true, $fields);224 $output = merge_results($output, $result);225 $result = lookup_users_by_name($key, $single, true, $fields);226 $output = merge_results($output, $result);227 $result = lookup_users_by_pref_name($key, $single, true, $fields);228 $output = merge_results($output, $result);229 $result = lookup_users_by_badgename($key, $single, true, $fields);230 $output = merge_results($output, $result);231 return $output;232 } else {233 if (is_numeric($key) ||234 (strtoupper($key)[0] == 'A' && is_numeric(substr($key, 1)))) {235 if (strtoupper($key)[0] == 'A') {236 return lookup_user_by_id(substr($key, 1), $fields);237 } else {238 return lookup_user_by_id($key, $fields);239 }240 } elseif (strpos($key, '@') !== false) {241 return lookup_users_by_email($key, $single, false, $fields);242 } else {243 $output = lookup_users_by_name($key, $single, $fields);244 if (count($output['users']) == 0) {245 $output = lookup_users_by_pref_name($key, $single, $fields);246 }247 if ($badgename && count($output['users']) == 0) {248 $output = lookup_users_by_badgename($key, $single, $fields);249 }250 return $output;251 }252 }253}254function lookup_users_by_name_email($first, $last, $email, $fields, $single_user = false, $substring = false)255{256 if (\ciab\CRM::active()) {257 return \ciab\CRM::lookupUsersByNameEmail($first, $last, $email, $fields, $single_user, $substring);258 }259 $criteria = array();260 if ($first) {261 if ($substring) {262 array_push($criteria, "FirstName LIKE '%$first%'");263 } else {264 array_push($criteria, "FirstName = '$first'");265 }266 }267 if ($last) {268 if ($substring) {269 array_push($criteria, "LastName LIKE '%$last%'");270 } else {271 array_push($criteria, "LastName = '$last'");272 }273 }274 if ($email) {275 if ($substring) {276 array_push($criteria, "Email LIKE '%$email%'");277 } else {278 array_push($criteria, "Email = '$email'");279 }280 }281 $stmt = implode(" AND ", $criteria);282 return _lookup_user($stmt, $single_user, $fields);283}284function lookup_user_by_login($user, $substring = false, $fields = array())285{286 $output = lookup_users_by_email($user, false, $substring, $fields);287 if (count($output['users']) == 0) {288 if (\ciab\CRM::active()) {289 $output = \ciab\CRM::lookupUserByLogin($user, $substring, $fields);290 } else {291 if ($substring) {292 $output = _lookup_user("Login LIKE '%$user%'", false, $fields);293 } else {294 $output = _lookup_user("Login = '$user'", false, $fields);295 }296 }297 }298 if (count($output['users']) == 0) {299 return array();300 } else {301 foreach ($output['users'] as $key => $user) {302 $output['users'][$key]['AccountID'] = $user['Id'];303 }304 return $output['users'];305 }306}307function pullIndividualAccount($accountId)308{309 $sql = "SELECT * FROM `Members` WHERE AccountId = $accountId;";310 $result = \DB::run($sql);311 $value = $result->fetch();312 if ($value === false) {313 return null;314 } else {315 return $value;316 }317}318function listCountries()319{320 $datafile = file_get_contents(__DIR__.'/../data/countries.json');321 $data = json_decode($datafile);322 $countries = array();323 foreach ($data as $key => $line) {324 array_push($countries, ['id' => $key, 'name' => $line]);325 }326 return $countries;327}328function _process_field(&$data, $updateData, $field, $target, $binary = false)329{330 if (isset($updateData[$field])) {331 if ($binary || !empty($updateData[$field])) {332 if ($binary) {333 array_push($data, "`$target` = ".$updateData[$field]);334 } else {335 $result = _quote($updateData[$field]);336 array_push($data, "`$target` = $result");337 }338 } else {339 array_push($data, "`$target` = null");340 }341 }342}343function updateAccount($updateData, $accountId)344{345 if (array_key_exists('country', $updateData)) {346 $countries = listCountries();347 foreach ($countries as $country) {348 if ($country['id'] === $updateData['country']) {349 $updateData['countryName'] = $country['name'];350 break;351 }352 }353 }354 $sql = "UPDATE `Members` SET ";355 $data = array();356 if (isset($updateData['firstName'])) {357 array_push($data, "`FirstName` = '".$updateData['firstName']."'");358 }359 if (isset($updateData['lastName'])) {360 array_push($data, "`LastName` = '".$updateData['lastName']."'");361 }362 _process_field($data, $updateData, 'middleName', 'MiddleName');363 _process_field($data, $updateData, 'suffix', 'Suffix');364 _process_field($data, $updateData, 'email1', 'Email');365 _process_field($data, $updateData, 'email2', 'Email2');366 _process_field($data, $updateData, 'email3', 'Email3');367 _process_field($data, $updateData, 'phone1', 'Phone');368 _process_field($data, $updateData, 'phone2', 'Phone2');369 _process_field($data, $updateData, 'addressLine1', 'AddressLine1');370 _process_field($data, $updateData, 'addressLine2', 'AddressLine2');371 _process_field($data, $updateData, 'city', 'AddressCity');372 _process_field($data, $updateData, 'state', 'AddressState');373 _process_field($data, $updateData, 'zipCode', 'AddressZipCode');374 _process_field($data, $updateData, 'zipPlus4', 'AddressZipCodeSuffix');375 _process_field($data, $updateData, 'countryName', 'AddressCountry');376 _process_field($data, $updateData, 'province', 'AddressProvince');377 _process_field($data, $updateData, 'preferredFirstName', 'PreferredFirstName');378 _process_field($data, $updateData, 'preferredLastName', 'PreferredLastName');379 _process_field($data, $updateData, 'Deceased', 'Deceased', true);380 _process_field($data, $updateData, 'DoNotContact', 'DoNotContact', true);381 _process_field($data, $updateData, 'EmailOptOut', 'EmailOptOut', true);382 _process_field($data, $updateData, 'Birthdate', 'Birthdate');383 _process_field($data, $updateData, 'Gender', 'Gender');384 _process_field($data, $updateData, 'conComDisplayPhone', 'DisplayPhone', true);385 $sql .= implode(", ", $data);386 $sql .= " WHERE `AccountID` = $accountId;";387 \DB::run($sql);388 if (\ciab\CRM::active()) {389 \ciab\CRM::updateAccount($updateData);390 }391}392function createUser($newemail, $min_accountid = null)393{394 $sel_sql = "SELECT AccountID FROM `Members` WHERE `Email` = '$newemail';";395 $result = DB::run($sel_sql);396 $value = $result->fetch();397 if ($value !== false) {398 return null;399 }400 $aid = null;401 if ($min_accountid !== null && intval($min_accountid) > 0) {402 $aid = intval($min_accountid);403 $sql = "SELECT MAX(AccountID) AS max FROM `Members`;";404 $result = DB::run($sql);405 $value = $result->fetch();406 if ($value !== false) {407 if (intval($value['max']) >= $aid) {408 $aid = null;409 }410 }411 }412 if ($aid !== null) {413 $sql = "INSERT INTO `Members` (`AccountID`, `Email`) VALUES ($aid, '$newemail');";414 } else {415 $sql = "INSERT INTO `Members` (`Email`) VALUES ('$newemail');";416 }417 DB::run($sql);418 $result = DB::run($sel_sql);419 $value = $result->fetch();420 if ($value === false) {421 return null;422 } else {423 return $value['AccountID'];424 }425}426function createPassword(/*.string.*/$id, /*.string.*/$password): string427{428 global $PASSWORDEXPIRE;429 if (isset($PASSWORDEXPIRE) && !empty($PASSWORDEXPIRE)) {430 $duration = $PASSWORDEXPIRE;431 } else {432 $duration = '+1 year';433 }434 $value = lookup_user_by_login($id);435 if (count($value)) {436 $user = $value[0]['AccountID'];437 $expires = _quote(date('Y-m-d H:i', strtotime($duration)));438 $auth = _quote(password_hash($password, PASSWORD_DEFAULT));439 $sql = <<<SQL440 INSERT INTO `Authentication` (AccountID, Authentication, Expires)441 VALUES ($user, $auth, $expires)442SQL;443 DB::run($sql);444 return true;445 }446 return false;447}...

Full Screen

Full Screen

view.php

Source:view.php Github

copy

Full Screen

...4 "branches/0.2.0" => "0.2.0", "unknown_branch" => "??",5 "paul.biggar" => "pb", "edskodevries" => "edv",6 );7 include ("common.php");8 function run_main ()9 {10 global $DB;11 $order = array (12 "revision",13 "branch",14 "author",15 "pass",16 "fail",17 "skip",18 "timeout",19 "benchmark",20 "time_taken",21 "test_date",22 "revision_used",23 "failed",24 "redo");25 foreach ($order as $header)26 {27 $headers[$header] = ucfirst (str_replace ("_", " ", $header));28 }29 $headers["revision"] = "Rev";30 $headers["revision_used"] = "Test rev";31 $headers["time_taken"] = "Time";32 $headers["benchmark"] = "Bench";33 $headers["timeout"] = "T/O";34 print "<table class=info>\n";35 print "<tr>\n";36 foreach (array_values ($headers) as $header)37 print "<th>$header</th>\n";38 // Completed tests39 $query = $DB->query ("40 SELECT revision, branch, author41 FROM complete42 ");43 $completes = $query->fetchAll(PDO::FETCH_ASSOC);44 // Test results45 $query = $DB->query ("46 SELECT revision, pass, fail, skip, timeout47 FROM tests48 WHERE testname == 'Total'49 ");50 $tests = $query->fetchAll(PDO::FETCH_ASSOC);51 // Benchmark results52 $query = $DB->query ("53 SELECT revision, result as benchmark54 FROM benchmarks55 WHERE metric = 'All'56 ");57 $benchmarks = $query->fetchAll(PDO::FETCH_ASSOC);58 // Compile meta-results59 $query = $DB->query ("60 SELECT revision, component, time_taken, test_date, revision_used, failed, redo61 FROM components62 WHERE component == 'compile'63 ");64 $compile_meta = $query->fetchAll(PDO::FETCH_ASSOC);65 // Test meta-results66 $query = $DB->query ("67 SELECT revision, component, time_taken, test_date, revision_used, failed, redo68 FROM components69 WHERE component == 'test'70 ");71 $test_meta = $query->fetchAll(PDO::FETCH_ASSOC);72 // Bench meta-results73 $query = $DB->query ("74 SELECT revision, component, time_taken, test_date, revision_used, failed, redo75 FROM components76 WHERE component == 'benchmark'77 ");78 $bench_meta = $query->fetchAll(PDO::FETCH_ASSOC);79 $query = $DB->query ("SELECT revision FROM running");80 $running = $query->fetchAll(PDO::FETCH_ASSOC);81 $running = $running[0]["revision"];82 $revisions = array_reduce (array ($completes, $tests, $benchmarks, $compile_meta, $test_meta, $bench_meta), "merge_results");83 ksort ($revisions);84 # process data85 foreach ($revisions as $rev => &$data)86 {87 // Always use the correct branch for relative data88 $branch = $data["branch"];89 $data["difference"] = add_difference ("pass", $data, $revisions[$prev[$branch]]);90 add_difference ("fail", $data, $revisions[$prev[$branch]]);91 $prev[$branch] = $rev;92 }93 $revisions = array_reverse ($revisions, true);94 # print out rows95 foreach ($revisions as $rev => $data)96 {97 print "<tr>\n";98 # pick a color99 $color = "";100 if ($data["difference"] > 0)101 $color = get_good_color ();102 elseif ($data["difference"] < 0)103 $color = get_bad_color ();104 unset ($data["difference"]);105 if ($rev == $running)106 $color = get_running_color ();107 # add a link to revision108 $data["revision"] = "<a href=\"details.php?rev=$rev\">$rev</a>";109 if (isset ($data["test_date"]))110 $data["test_date"] = date_from_timestamp ($data["test_date"]);111 if (isset ($data["time_taken"]))112 $data["time_taken"] = minutes_from_seconds($data["time_taken"]);113 foreach ($order as $header)114 {115 $value = $data[$header];116 print "<td $color>$value</td>\n";117 }118 print "<a/></tr>\n";119 }120 }...

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1$merge = new merge_results();2$merge->run();3$merge = new merge_results();4$merge->run();5$merge = new merge_results();6$merge->run();7$merge = new merge_results();8$merge->run();9$merge = new merge_results();10$merge->run();11$merge = new merge_results();12$merge->run();13$merge = new merge_results();14$merge->run();15$merge = new merge_results();16$merge->run();17$merge = new merge_results();18$merge->run();19$merge = new merge_results();20$merge->run();21$merge = new merge_results();22$merge->run();23$merge = new merge_results();24$merge->run();25$merge = new merge_results();26$merge->run();27$merge = new merge_results();28$merge->run();29$merge = new merge_results();30$merge->run();31$merge = new merge_results();32$merge->run();33$merge = new merge_results();34$merge->run();

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1require_once('merge_results.php');2$merge_results = new merge_results();3$merge_results->run();4require_once('merge_results.php');5$merge_results = new merge_results();6$merge_results->run();7require_once('merge_results.php');8$merge_results = new merge_results();9$merge_results->run();10require_once('merge_results.php');11$merge_results = new merge_results();12$merge_results->run();13require_once('merge_results.php');14$merge_results = new merge_results();15$merge_results->run();16require_once('merge_results.php');17$merge_results = new merge_results();18$merge_results->run();19require_once('merge_results.php');20$merge_results = new merge_results();21$merge_results->run();22require_once('merge_results.php');23$merge_results = new merge_results();24$merge_results->run();25require_once('merge_results.php');26$merge_results = new merge_results();27$merge_results->run();28require_once('merge_results.php');29$merge_results = new merge_results();30$merge_results->run();31require_once('merge_results.php');32$merge_results = new merge_results();33$merge_results->run();34require_once('merge_results.php');35$merge_results = new merge_results();36$merge_results->run();

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1require_once 'merge_results.php';2$merge_results = new merge_results();3$merge_results->run();4require_once 'merge_results.php';5$merge_results = new merge_results();6$merge_results->run();7require_once 'merge_results.php';8$merge_results = new merge_results();9$merge_results->run();10require_once 'merge_results.php';11$merge_results = new merge_results();12$merge_results->run();13require_once 'merge_results.php';14$merge_results = new merge_results();15$merge_results->run();16require_once 'merge_results.php';17$merge_results = new merge_results();18$merge_results->run();19require_once 'merge_results.php';20$merge_results = new merge_results();21$merge_results->run();22require_once 'merge_results.php';23$merge_results = new merge_results();24$merge_results->run();25require_once 'merge_results.php';26$merge_results = new merge_results();27$merge_results->run();28Warning: require_once(merge_results.php): failed to open stream: No such file or directory in /home/username/public_html/1.php on line 229Fatal error: require_once(): Failed opening required 'merge_results.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/1.php on line 2

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1$merge = new merge_results;2$merge->run($results);3$merge = new merge_results;4$merge->run($results);5$merge = new merge_results;6$merge->run($results);7$merge = new merge_results;8$merge->run($results);9$merge = new merge_results;10$merge->run($results);11$merge = new merge_results;12$merge->run($results);13$merge = new merge_results;14$merge->run($results);15$merge = new merge_results;16$merge->run($results);17$merge = new merge_results;18$merge->run($results);19$merge = new merge_results;20$merge->run($results);21$merge = new merge_results;22$merge->run($results);23$merge = new merge_results;24$merge->run($results);25$merge = new merge_results;26$merge->run($results);27$merge = new merge_results;28$merge->run($results);29$merge = new merge_results;30$merge->run($results);31$merge = new merge_results;32$merge->run($results);

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1include('merge_results.php');2$obj = new merge_results;3$obj->run();4include('merge_results.php');5$obj = new merge_results;6$obj->run();7include('merge_results.php');8$obj = new merge_results;9$obj->run();10include('merge_results.php');11$obj = new merge_results;12$obj->run();13include('merge_results.php');14$obj = new merge_results;15$obj->run();16include('merge_results.php');17$obj = new merge_results;18$obj->run();19include('merge_results.php');20$obj = new merge_results;21$obj->run();

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1require_once 'merge_results.php';2$merge=new merge_results();3$merge->run();4public function run()5{6 $this->get_data();7 $this->merge_data();8 $this->write_data();9}10public function get_data()11{12 $this->data1=file_get_contents("1.txt");13 $this->data2=file_get_contents("2.txt");14}15public function merge_data()16{17 $this->data1.=$this->data2;18}19public function write_data()20{21 file_put_contents("3.txt",$this->data1);22}23require_once 'merge_results.php';24$merge=new merge_results();25$merge->run();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in merge_results

Trigger run code on LambdaTest Cloud Grid

Execute automation tests with run on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful