diff --git a/includes/defines.php b/includes/defines.php index 4f92bbdc..386e3826 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -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); diff --git a/includes/profiler.class.php b/includes/profiler.class.php index 3f73a998..b69ea012 100644 --- a/includes/profiler.class.php +++ b/includes/profiler.class.php @@ -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...'); diff --git a/includes/types/profile.class.php b/includes/types/profile.class.php index 8c7d4169..eb615ce2 100644 --- a/includes/types/profile.class.php +++ b/includes/types/profile.class.php @@ -44,10 +44,11 @@ class ProfileList extends BaseType 'gearscore' => $this->getField('gearscore') ); - // for the lv this determins if the link is profile= or profile=.. - 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= or profile=.. + if (!$this->isCustom()) $data[$this->id]['region'] = Profiler::urlize($this->getField('region')); if ($addInfo & PROFILEINFO_ARENA) diff --git a/pages/user.php b/pages/user.php index 80a73754..2bdfab9a 100644 --- a/pages/user.php +++ b/pages/user.php @@ -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() diff --git a/prQueue b/prQueue index e26d2f65..7f44d387 100755 --- a/prQueue +++ b/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']); } diff --git a/setup/db_structure.sql b/setup/db_structure.sql index defafb86..91ce43ee 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -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; diff --git a/setup/updates/1522499480_01.sql b/setup/updates/1522499480_01.sql new file mode 100644 index 00000000..84ba2de6 --- /dev/null +++ b/setup/updates/1522499480_01.sql @@ -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]!', '', ''); +