mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Profiler
* translate anouncements for loc 3 * fix queue locking up on error * fix queue status display * fix flagging real characters as private
This commit is contained in:
@@ -212,6 +212,7 @@ define('PROFILEINFO_PROFILE', 0x1);
|
||||
define('PROFILEINFO_CHARACTER', 0x2);
|
||||
define('PROFILEINFO_GUILD', 0x10); // like &roster
|
||||
define('PROFILEINFO_ARENA', 0x20);
|
||||
define('PROFILEINFO_USER', 0x40);
|
||||
|
||||
define('SPAWNINFO_ZONES', 1); // not a mask, mutually exclusive
|
||||
define('SPAWNINFO_SHORT', 2);
|
||||
|
||||
@@ -286,6 +286,8 @@ class Profiler
|
||||
|
||||
// reminder: this query should not fail: a placeholder entry is created as soon as a char listview is created or profile detail page is called
|
||||
$profileId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID = ?d', $realmId, $char['guid']);
|
||||
if (!$profileId)
|
||||
return false; // well ... it failed
|
||||
|
||||
CLI::write('fetching char #'.$charGuid.' from realm #'.$realmId);
|
||||
CLI::write('writing...');
|
||||
|
||||
@@ -44,10 +44,11 @@ class ProfileList extends BaseType
|
||||
'gearscore' => $this->getField('gearscore')
|
||||
);
|
||||
|
||||
// for the lv this determins if the link is profile=<id> or profile=<region>.<realm>.<name>
|
||||
if ($this->isCustom())
|
||||
if ($addInfo & PROFILEINFO_USER)
|
||||
$data[$this->id]['published'] = (int)!!($this->getField('cuFlags') & PROFILER_CU_PUBLISHED);
|
||||
else
|
||||
|
||||
// for the lv this determins if the link is profile=<id> or profile=<region>.<realm>.<name>
|
||||
if (!$this->isCustom())
|
||||
$data[$this->id]['region'] = Profiler::urlize($this->getField('region'));
|
||||
|
||||
if ($addInfo & PROFILEINFO_ARENA)
|
||||
|
||||
@@ -234,43 +234,13 @@ class UserPage extends GenericPage
|
||||
$this->addJS('?data=weight-presets&t='.$_SESSION['dataKey']);
|
||||
|
||||
// Characters
|
||||
if ($chars = $profiles->getListviewData(PROFILEINFO_CHARACTER))
|
||||
if ($chars = $profiles->getListviewData(PROFILEINFO_CHARACTER | PROFILEINFO_USER))
|
||||
$this->user['characterData'] = $chars;
|
||||
|
||||
// Profiles
|
||||
if ($prof = $profiles->getListviewData(PROFILEINFO_PROFILE))
|
||||
if ($prof = $profiles->getListviewData(PROFILEINFO_PROFILE | PROFILEINFO_USER))
|
||||
$this->user['profileData'] = $prof;
|
||||
}
|
||||
|
||||
/*
|
||||
us_addCharactersTab([
|
||||
{
|
||||
id:763,
|
||||
"name":"Lilywhite",
|
||||
"achievementpoints":"0",
|
||||
"guild":"whatever",
|
||||
"guildrank":"0",
|
||||
"realm":"draenor",
|
||||
"realmname":"Draenor",
|
||||
"battlegroup":"cyclone",
|
||||
"battlegroupname":"Cyclone",
|
||||
"region":"us",
|
||||
"level":"10",
|
||||
"race":"7",
|
||||
"gender":"0",
|
||||
"classs":"1",
|
||||
"faction":"0",
|
||||
"gearscore":"0",
|
||||
"talenttree1":"0",
|
||||
"talenttree2":"0",
|
||||
"talenttree3":"0",
|
||||
"talentspec":0,
|
||||
"published":1,
|
||||
"pinned":0
|
||||
}
|
||||
]);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
protected function generateTitle()
|
||||
|
||||
28
prQueue
28
prQueue
@@ -25,7 +25,7 @@ CLI::write('profiler queue started', CLI::LOG_OK);
|
||||
set_time_limit(0);
|
||||
$tCycle = microtime(true);
|
||||
|
||||
$error = function ($type, $typeId, $realmId)
|
||||
$error = function ($type, $realmGUID, $realmId)
|
||||
{
|
||||
$what = '';
|
||||
if ($type == TYPE_PROFILE)
|
||||
@@ -35,24 +35,15 @@ $error = function ($type, $typeId, $realmId)
|
||||
if ($type == TYPE_ARENA_TEAM)
|
||||
$what = 'arena team';
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_profiler_sync SET status = ?d, errorCode = ?d WHERE realm = ?d AND type = ?d AND typeId = ?d', PR_QUEUE_STATUS_ERROR, PR_QUEUE_ERROR_CHAR, $realmId, $type, $typeId);
|
||||
trigger_error('prQueue - unknown '.$what.' guid #'.$typeId.' on realm #'.$realmId.' to sync into profiler.', E_USER_WARNING);
|
||||
CLI::write('unknown '.$what.' guid #'.$typeId.' on realm #'.$realmId.' to sync into profiler.', CLI::LOG_WARN);
|
||||
DB::Aowow()->query('UPDATE ?_profiler_sync SET status = ?d, errorCode = ?d WHERE realm = ?d AND realmGUID = ?d AND type = ?d', PR_QUEUE_STATUS_ERROR, PR_QUEUE_ERROR_CHAR, $realmId, $realmGUID, $type);
|
||||
trigger_error('prQueue - unknown '.$what.' guid #'.$realmGUID.' on realm #'.$realmId.' to sync into profiler.', E_USER_WARNING);
|
||||
CLI::write('unknown '.$what.' guid #'.$realmGUID.' on realm #'.$realmId.' to sync into profiler.', CLI::LOG_WARN);
|
||||
};
|
||||
|
||||
|
||||
// if (CFG_PROFILER_ENABLE) - wont work because it is not redefined if changed in config
|
||||
while (DB::Aowow()->selectCell('SELECT value FROM ?_config WHERE `key` = "profiler_enable"'))
|
||||
{
|
||||
if (($tDiff = (microtime(true) - $tCycle)) < (CFG_PROFILER_QUEUE_DELAY / 1000))
|
||||
{
|
||||
$wait = (CFG_PROFILER_QUEUE_DELAY / 1000) - $tDiff;
|
||||
CLI::write('sleeping '.Lang::nf($wait, 2).'s..');
|
||||
usleep($wait * 1000 * 1000);
|
||||
}
|
||||
|
||||
$tCycle = microtime(true);
|
||||
|
||||
$row = DB::Aowow()->selectRow('SELECT * FROM ?_profiler_sync WHERE status = ?d ORDER BY requestTime ASC', PR_QUEUE_STATUS_WAITING);
|
||||
if (!$row)
|
||||
{
|
||||
@@ -72,7 +63,7 @@ while (DB::Aowow()->selectCell('SELECT value FROM ?_config WHERE `key` = "profil
|
||||
continue;
|
||||
}
|
||||
else
|
||||
DB::Aowow()->query('UPDATE ?_profiler_sync SET status = ?d WHERE requestTime = ?d AND realm = ?d AND type = ?d AND typeId = ?d', PR_QUEUE_STATUS_WORKING, time(), $row['realm'], $row['type'], $row['typeId']);
|
||||
DB::Aowow()->query('UPDATE ?_profiler_sync SET status = ?d WHERE realm = ?d AND type = ?d AND typeId = ?d', PR_QUEUE_STATUS_WORKING, $row['realm'], $row['type'], $row['typeId']);
|
||||
|
||||
switch ($row['type'])
|
||||
{
|
||||
@@ -106,6 +97,15 @@ while (DB::Aowow()->selectCell('SELECT value FROM ?_config WHERE `key` = "profil
|
||||
CLI::write('unknown type #'.$row['type'].' to sync into profiler. Removing from queue...', CLI::LOG_ERROR);
|
||||
}
|
||||
|
||||
if (($tDiff = (microtime(true) - $tCycle)) < (CFG_PROFILER_QUEUE_DELAY / 1000))
|
||||
{
|
||||
$wait = (CFG_PROFILER_QUEUE_DELAY / 1000) - $tDiff;
|
||||
CLI::write('sleeping '.Lang::nf($wait, 2).'s..');
|
||||
usleep($wait * 1000 * 1000);
|
||||
}
|
||||
|
||||
$tCycle = microtime(true);
|
||||
|
||||
// mark as ready
|
||||
DB::Aowow()->query('UPDATE ?_profiler_sync SET status = ?d, errorCode = 0 WHERE realm = ?d AND type = ?d AND typeId = ?d', PR_QUEUE_STATUS_READY, $row['realm'], $row['type'], $row['typeId']);
|
||||
}
|
||||
|
||||
@@ -2991,7 +2991,7 @@ UNLOCK TABLES;
|
||||
|
||||
LOCK TABLES `aowow_announcements` WRITE;
|
||||
/*!40000 ALTER TABLE `aowow_announcements` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_announcements` VALUES (4,'compare','Help: Item Comparison Tool',0,'padding-left: 55px; background-image: url(STATIC_URL/images/announcements/help-small.png); background-position: 10px center',1,1,'First time? - Don\'t be shy! Just check out our [url=?help=item-comparison]Help page[/url]!','Première visite? - Ne soyez pas intimidé! Vous n\'avez qu\'à lire notre [url=?help=item-comparison]page d\'aide[/url] !','Euer erstes Mal? Nur keine falsche Scheu! Schaut einfach auf unsere [url=?help=item-comparison]Hilfeseite[/url]!','¿Tu primera vez? ¡No seas vergonzoso! !Mira nuestra [url=?help=item-comparison]página de ayuda[/url]!','Впервые? Не стесняйтесь посетить нашу [url=?help=item-comparison]справочную страницу[/url]!'),(3,'profile','Quick Help: Profiler',0,'padding-left: 80px; background-image: url(STATIC_URL/images/announcements/help-large.gif); background-position: 10px center',1,1,'[h3]First Time?[/h3]\n\nThe [b]Profiler[/b] lets you [span class=tip title=\"e.g. See how\'d you look as a different race!\"]edit your character[/span], find gear upgrades, check your gear score, and more!\n\n[ul]\n[li][b]Right-click[/b] slots to change items, add gems/enchants, or find upgrades.[/li]\n[li]Use the [b]Claim character[/b] button to add your own characters to your [url=?user]user page[/url].[/li]\n[li]Save a modified character to your Aowow account by using the [b]Save as[/b] button.[/li]\n[li][b]Statistics[/b] will update in real time as you make tweaks.[/li]\n[/ul]\n\nFor more information, check out our extensive [b][url=?help=profiler]help page[/url][/b]!','','','',''),(2,'profiler','Help: Profiler',0,'padding-left: 80px; background-image: url(STATIC_URL/images/announcements/help-large.gif); background-position: 10px center',1,1,'[h3]First Time?[/h3]\r\n\r\nThe [b]Profiler[/b] tool lets you [span class=tip title=\"e.g. See how\'d you look as a different race, try different gear or talents, and more!\"]edit your character[/span], find gear upgrades, check your gear score, and more!\r\n\r\n[ul]\r\n[li][b]Right-click[/b] slots to change items, add gems/enchants, or find upgrades.[/li]\r\n[li]Use the [b]Claim character[/b] button to add your own characters to your [url=/?user]user page[/url].[/li]\r\n[li]Save a modified character to your Aowow account by using the [b]Save as[/b] button.[/li]\r\n[li][b]Statistics[/b] will update in real time as you make tweaks.[/li]\r\n[/ul]\r\n\r\nFor more information, check out our extensive [url=?help=profiler]help page[/url]!','','','','');
|
||||
INSERT INTO `aowow_announcements` VALUES (4,'compare','Help: Item Comparison Tool',0,'padding-left: 55px; background-image: url(STATIC_URL/images/announcements/help-small.png); background-position: 10px center',1,1,'First time? - Don\'t be shy! Just check out our [url=?help=item-comparison]Help page[/url]!','Première visite? - Ne soyez pas intimidé! Vous n\'avez qu\'à lire notre [url=?help=item-comparison]page d\'aide[/url] !','Euer erstes Mal? Nur keine falsche Scheu! Schaut einfach auf unsere [url=?help=item-comparison]Hilfeseite[/url]!','¿Tu primera vez? ¡No seas vergonzoso! !Mira nuestra [url=?help=item-comparison]página de ayuda[/url]!','Впервые? Не стесняйтесь посетить нашу [url=?help=item-comparison]справочную страницу[/url]!'),(3,'profile','Help: Profiler',0,'padding-left: 80px; background-image: url(STATIC_URL/images/announcements/help-large.gif); background-position: 10px center',1,1,'[h3]First Time?[/h3]\r\n\r\nThe [b]Profiler[/b] tool lets you [span class=tip title=\"e.g. See how\'d you look as a different race, try different gear or talents, and more!\"]edit your character[/span], find gear upgrades, check your gear score, and more!\r\n\r\n[ul]\r\n[li][b]Right-click[/b] slots to change items, add gems/enchants, or find upgrades.[/li]\r\n[li]Use the [b]Claim character[/b] button to add your own characters to your [url=/?user]user page[/url].[/li]\r\n[li]Save a modified character to your Aowow account by using the [b]Save as[/b] button.[/li]\r\n[li][b]Statistics[/b] will update in real time as you make tweaks.[/li]\r\n[/ul]\r\n\r\nFor more information, check out our extensive [url=?help=profiler]help page[/url]!','','[h3]Euer erster Besuch?[/h3]\n\nDas [b]Profiler[/b]-Werkzeug erlaubt es euch [span class=tip title=\"z.B. Seht, wie Ihr als anderes Volk aussehen würdet, probiert andere Ausrüstung oder Talente aus, und mehr!\"]euren Charakter zu bearbeiten[/span], besser Ausrüstung zu finden, eure Ausrüstungswertung zu vergleichen, und vieles mehr!\n\n[ul]\n[li][b]Rechts-klickt[/b] Plätze um Gegenstände zu tauschen, Edelsteine/Verzauberungen hinzuzufügen, oder bessere AUsrüstung zu finden.[/li]\n[li]Benutzt [b]Charakter beanspruchen[/b] um eure eigenen Charaktere Eurer [url=?user]Benutzerseite[/url] hinzuzufügen.[/li]\n[li]Speichert einen modifizierten Charakter in Eurem Aowow-Konto, indem Ihr [b]Speichern als[/b] benutzt.[/li]\n[li]Die [b]Statistiken[/b] aktualisieren sich in Echtzeit, während Ihr Änderungen durchführt.[/li]\n[/ul]\n\nWeitere Informationen findet Ihr auf unserer umfangreichen [url=?help=profiler]Hilfeseite[/url]!','',''),(2,'profiler','Help: Profiler',0,'padding-left: 80px; background-image: url(STATIC_URL/images/announcements/help-large.gif); background-position: 10px center',1,1,'[h3]First Time?[/h3]\r\n\r\nThe [b]Profiler[/b] tool lets you [span class=tip title=\"e.g. See how\'d you look as a different race, try different gear or talents, and more!\"]edit your character[/span], find gear upgrades, check your gear score, and more!\r\n\r\n[ul]\r\n[li][b]Right-click[/b] slots to change items, add gems/enchants, or find upgrades.[/li]\r\n[li]Use the [b]Claim character[/b] button to add your own characters to your [url=/?user]user page[/url].[/li]\r\n[li]Save a modified character to your Aowow account by using the [b]Save as[/b] button.[/li]\r\n[li][b]Statistics[/b] will update in real time as you make tweaks.[/li]\r\n[/ul]\r\n\r\nFor more information, check out our extensive [url=?help=profiler]help page[/url]!','','[h3]Euer erster Besuch?[/h3]\n\nDas [b]Profiler[/b]-Werkzeug erlaubt es euch [span class=tip title=\"z.B. Seht, wie Ihr als anderes Volk aussehen würdet, probiert andere Ausrüstung oder Talente aus, und mehr!\"]euren Charakter zu bearbeiten[/span], besser Ausrüstung zu finden, eure Ausrüstungswertung zu vergleichen, und vieles mehr!\n\n[ul]\n[li][b]Rechts-klickt[/b] Plätze um Gegenstände zu tauschen, Edelsteine/Verzauberungen hinzuzufügen, oder bessere AUsrüstung zu finden.[/li]\n[li]Benutzt [b]Charakter beanspruchen[/b] um eure eigenen Charaktere Eurer [url=?user]Benutzerseite[/url] hinzuzufügen.[/li]\n[li]Speichert einen modifizierten Charakter in Eurem Aowow-Konto, indem Ihr [b]Speichern als[/b] benutzt.[/li]\n[li]Die [b]Statistiken[/b] aktualisieren sich in Echtzeit, während Ihr Änderungen durchführt.[/li]\n[/ul]\n\nWeitere Informationen findet Ihr auf unserer umfangreichen [url=?help=profiler]Hilfeseite[/url]!','','');
|
||||
/*!40000 ALTER TABLE `aowow_announcements` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -3021,7 +3021,7 @@ UNLOCK TABLES;
|
||||
|
||||
LOCK TABLES `aowow_dbversion` WRITE;
|
||||
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_dbversion` VALUES (1522421325,0,NULL,NULL);
|
||||
INSERT INTO `aowow_dbversion` VALUES (1522499481,0,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
5
setup/updates/1522499480_01.sql
Normal file
5
setup/updates/1522499480_01.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
DELETE FROM `aowow_announcements` WHERE page = 'profile' OR page = 'profiler';
|
||||
INSERT INTO `aowow_announcements` (`page`, `name`, `groupMask`, `style`, `mode`, `status`, `text_loc0`, `text_loc2`, `text_loc3`, `text_loc6`, `text_loc8`) VALUES
|
||||
('profile', 'Help: Profiler', 0, 'padding-left: 80px; background-image: url(STATIC_URL/images/announcements/help-large.gif); background-position: 10px center', 1, 1, '[h3]First Time?[/h3]\r\n\r\nThe [b]Profiler[/b] tool lets you [span class=tip title="e.g. See how\'d you look as a different race, try different gear or talents, and more!"]edit your character[/span], find gear upgrades, check your gear score, and more!\r\n\r\n[ul]\r\n[li][b]Right-click[/b] slots to change items, add gems/enchants, or find upgrades.[/li]\r\n[li]Use the [b]Claim character[/b] button to add your own characters to your [url=/?user]user page[/url].[/li]\r\n[li]Save a modified character to your Aowow account by using the [b]Save as[/b] button.[/li]\r\n[li][b]Statistics[/b] will update in real time as you make tweaks.[/li]\r\n[/ul]\r\n\r\nFor more information, check out our extensive [url=?help=profiler]help page[/url]!', '', '[h3]Euer erster Besuch?[/h3]\n\nDas [b]Profiler[/b]-Werkzeug erlaubt es euch [span class=tip title="z.B. Seht, wie Ihr als anderes Volk aussehen würdet, probiert andere Ausrüstung oder Talente aus, und mehr!"]euren Charakter zu bearbeiten[/span], besser Ausrüstung zu finden, eure Ausrüstungswertung zu vergleichen, und vieles mehr!\n\n[ul]\n[li][b]Rechts-klickt[/b] Plätze um Gegenstände zu tauschen, Edelsteine/Verzauberungen hinzuzufügen, oder bessere AUsrüstung zu finden.[/li]\n[li]Benutzt [b]Charakter beanspruchen[/b] um eure eigenen Charaktere Eurer [url=?user]Benutzerseite[/url] hinzuzufügen.[/li]\n[li]Speichert einen modifizierten Charakter in Eurem Aowow-Konto, indem Ihr [b]Speichern als[/b] benutzt.[/li]\n[li]Die [b]Statistiken[/b] aktualisieren sich in Echtzeit, während Ihr Änderungen durchführt.[/li]\n[/ul]\n\nWeitere Informationen findet Ihr auf unserer umfangreichen [url=?help=profiler]Hilfeseite[/url]!', '', ''),
|
||||
('profiler', 'Help: Profiler', 0, 'padding-left: 80px; background-image: url(STATIC_URL/images/announcements/help-large.gif); background-position: 10px center', 1, 1, '[h3]First Time?[/h3]\r\n\r\nThe [b]Profiler[/b] tool lets you [span class=tip title="e.g. See how\'d you look as a different race, try different gear or talents, and more!"]edit your character[/span], find gear upgrades, check your gear score, and more!\r\n\r\n[ul]\r\n[li][b]Right-click[/b] slots to change items, add gems/enchants, or find upgrades.[/li]\r\n[li]Use the [b]Claim character[/b] button to add your own characters to your [url=/?user]user page[/url].[/li]\r\n[li]Save a modified character to your Aowow account by using the [b]Save as[/b] button.[/li]\r\n[li][b]Statistics[/b] will update in real time as you make tweaks.[/li]\r\n[/ul]\r\n\r\nFor more information, check out our extensive [url=?help=profiler]help page[/url]!', '', '[h3]Euer erster Besuch?[/h3]\n\nDas [b]Profiler[/b]-Werkzeug erlaubt es euch [span class=tip title="z.B. Seht, wie Ihr als anderes Volk aussehen würdet, probiert andere Ausrüstung oder Talente aus, und mehr!"]euren Charakter zu bearbeiten[/span], besser Ausrüstung zu finden, eure Ausrüstungswertung zu vergleichen, und vieles mehr!\n\n[ul]\n[li][b]Rechts-klickt[/b] Plätze um Gegenstände zu tauschen, Edelsteine/Verzauberungen hinzuzufügen, oder bessere AUsrüstung zu finden.[/li]\n[li]Benutzt [b]Charakter beanspruchen[/b] um eure eigenen Charaktere Eurer [url=?user]Benutzerseite[/url] hinzuzufügen.[/li]\n[li]Speichert einen modifizierten Charakter in Eurem Aowow-Konto, indem Ihr [b]Speichern als[/b] benutzt.[/li]\n[li]Die [b]Statistiken[/b] aktualisieren sich in Echtzeit, während Ihr Änderungen durchführt.[/li]\n[/ul]\n\nWeitere Informationen findet Ihr auf unserer umfangreichen [url=?help=profiler]Hilfeseite[/url]!', '', '');
|
||||
|
||||
Reference in New Issue
Block a user