Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use apps versions to generate suffix when possible #7244

Merged
merged 4 commits into from
Dec 11, 2017

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Nov 22, 2017

  • Reduce the hash to 8 chars (readability)
  • Generate hash based on apps versions if possible and not nextcloud version

This will force css cache update on the user's browser side on app update. And avoid many errors like calendar or contacts had in the past.

@codecov
Copy link

codecov bot commented Nov 22, 2017

Codecov Report

Merging #7244 into master will decrease coverage by <.01%.
The diff coverage is 0%.

@@             Coverage Diff              @@
##             master    #7244      +/-   ##
============================================
- Coverage     50.97%   50.96%   -0.01%     
- Complexity    24735    24745      +10     
============================================
  Files          1586     1586              
  Lines         94257    94275      +18     
  Branches       1365     1365              
============================================
+ Hits          48049    48050       +1     
- Misses        46208    46225      +17
Impacted Files Coverage Δ Complexity Δ
lib/private/TemplateLayout.php 0% <0%> (ø) 45 <14> (+10) ⬆️
apps/files_trashbin/lib/Trashbin.php 72.53% <0%> (+0.24%) 136% <0%> (ø) ⬇️

@MorrisJobke
Copy link
Member

What I did:

  • open browser
  • noted down the hash of a CSS that was generated from SCSS: /server/css/files_sharing/d1b66d1f58bf8c563feed8479657874b-mergedAdditionalStyles.css
  • changed the version of files_sharing to 1.5.1 from 1.5.0
  • actual: same hash
  • expected: different hash

@skjnldsv What did I wrong?

@skjnldsv
Copy link
Member Author

@MorrisJobke It's the hash after the .css
You need to disable the debug mode though.

// allows chrome workspace mapping in debug mode
return "";
}
if ($app !== false && $app !== '') {
$v = \OC_App::getAppVersions();
$appName = end(explode('/', $app));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bildschirmfoto von 2017-11-29 14-09-54

Copy link
Member

@nickvergessen nickvergessen Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the explode looks like it wont work for apps/ next to server/ so where your $web is not straight forward?

}
}
}

protected function getVersionHashSuffix() {
if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
protected function getVersionHashSuffix($app=false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing spaces around =

@skjnldsv
Copy link
Member Author

skjnldsv commented Dec 5, 2017

All clear! Now we have nice and beautiful version suffixes! :)

<link rel="stylesheet" href="/apps/unsplash/css/login.css?v=f63163cd-18">
<link rel="stylesheet" href="/css/core/2933078af7952208ea8b73dc956a6293-share.css?v=190c0a6d-18">
<link rel="stylesheet" href="/apps/files_versions/css/versions.css?v=ca9f0d77-18">
<link rel="stylesheet" href="/css/core/2933078af7952208ea8b73dc956a6293-jquery.ocdialog.css?v=190c0a6d-18">
<link rel="stylesheet" href="/css/contacts/2933078af7952208ea8b73dc956a6293-style.css?v=47354877-18">
<link rel="stylesheet" href="/apps2/contacts/css/vendor/ui-select/select.min.css?v=47354877-18">

rullzer
rullzer previously requested changes Dec 6, 2017
}
return end($pathParts);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't lie in your phpdoc 😉 If you say you returning a string do so :P

* @param string $path
* @return string
*/
static public function getAppNamefromPath($path) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why this is a static method? I guess the static can be dropped here.

@MorrisJobke
Copy link
Member

@skjnldsv Could you address the comments? And then this can get in.

@skjnldsv
Copy link
Member Author

skjnldsv commented Dec 8, 2017

@MorrisJobke @rullzer all clear :)

@MorrisJobke MorrisJobke mentioned this pull request Dec 8, 2017
28 tasks
}
return end($pathParts);
}
return false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Syntax error: Missing ; 😉 Let me push a fix for this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was sure I pushed a fix for this! :O

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works with my syntax fix 👍

@MorrisJobke MorrisJobke added the 4. to release Ready to be released and/or waiting for tests to finish label Dec 11, 2017
@MorrisJobke MorrisJobke removed the 3. to review Waiting for reviews label Dec 11, 2017
skjnldsv and others added 4 commits December 11, 2017 14:24
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@MorrisJobke MorrisJobke force-pushed the css-file-suffix-with-apps-versions branch from 759bff6 to 52e7d05 Compare December 11, 2017 13:24
@MorrisJobke
Copy link
Member

Rebased to fix the failing integration test, that was fixed on master.

@MorrisJobke
Copy link
Member

Rebased to fix the failing integration test, that was fixed on master.

I was wrong - it was not yet merged to master -> CI looks good so far -> merging.

@MorrisJobke MorrisJobke merged commit f4d7afc into master Dec 11, 2017
@MorrisJobke MorrisJobke deleted the css-file-suffix-with-apps-versions branch December 11, 2017 13:51
@MorrisJobke
Copy link
Member

Of course I have overlooked one issue in the setup integration tests because of the other one.

{"reqId":"KzL6vs3sDWz9myzeplMg","level":3,"time":"2017-12-11T13:53:47+00:00","remoteAddr":"192.168.99.1","user":"--","app":"core","method":"GET","url":"\/server\/","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\DBALException\",\"Message\":\"Failed to connect to the database: An exception occurred while executing 'PRAGMA journal_mode = WAL':\\n\\nSQLSTATE[HY000]: General error: 10 disk I\\\/O error\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/projects\\\/server\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(992): OC\\\\DB\\\\Connection->connect()\\n#1 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/DB\\\/Connection.php(216): Doctrine\\\\DBAL\\\\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)\\n#2 \\\/srv\\\/projects\\\/server\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(623): OC\\\\DB\\\\Connection->executeUpdate('PRAGMA read_unc...')\\n#3 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/DB\\\/Connection.php(151): Doctrine\\\\DBAL\\\\Connection->setTransactionIsolation(2)\\n#4 \\\/srv\\\/projects\\\/server\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DriverManager.php(172): OC\\\\DB\\\\Connection->__construct(Array, Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOSqlite\\\\Driver), Object(Doctrine\\\\DBAL\\\\Configuration), Object(Doctrine\\\\Common\\\\EventManager))\\n#5 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/DB\\\/ConnectionFactory.php(152): Doctrine\\\\DBAL\\\\DriverManager::getConnection(Array, Object(Doctrine\\\\DBAL\\\\Configuration), Object(Doctrine\\\\Common\\\\EventManager))\\n#6 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/Server.php(605): OC\\\\DB\\\\ConnectionFactory->getConnection('sqlite', Array)\\n#7 \\\/srv\\\/projects\\\/server\\\/3rdparty\\\/pimple\\\/pimple\\\/src\\\/Pimple\\\/Container.php(113): OC\\\\Server->OC\\\\{closure}(*** sensitive parameters replaced ***)\\n#8 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('OCP\\\\\\\\IDBConnecti...')\\n#9 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/ServerContainer.php(132): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('OCP\\\\\\\\IDBConnecti...')\\n#10 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(164): OC\\\\ServerContainer->query('OCP\\\\\\\\IDBConnecti...')\\n#11 \\\/srv\\\/projects\\\/server\\\/3rdparty\\\/pimple\\\/pimple\\\/src\\\/Pimple\\\/Container.php(109): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->OC\\\\AppFramework\\\\Utility\\\\{closure}(*** sensitive parameters replaced ***)\\n#12 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('DatabaseConnect...')\\n#13 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/ServerContainer.php(132): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('DatabaseConnect...')\\n#14 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/Server.php(1414): OC\\\\ServerContainer->query('DatabaseConnect...')\\n#15 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/Server.php(421): OC\\\\Server->getDatabaseConnection()\\n#16 \\\/srv\\\/projects\\\/server\\\/3rdparty\\\/pimple\\\/pimple\\\/src\\\/Pimple\\\/Container.php(113): OC\\\\Server->OC\\\\{closure}(*** sensitive parameters replaced ***)\\n#17 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('OC\\\\\\\\AppConfig')\\n#18 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/ServerContainer.php(132): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('OC\\\\\\\\AppConfig')\\n#19 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(164): OC\\\\ServerContainer->query('OC\\\\\\\\AppConfig')\\n#20 \\\/srv\\\/projects\\\/server\\\/3rdparty\\\/pimple\\\/pimple\\\/src\\\/Pimple\\\/Container.php(109): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->OC\\\\AppFramework\\\\Utility\\\\{closure}(*** sensitive parameters replaced ***)\\n#21 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(116): Pimple\\\\Container->offsetGet('AppConfig')\\n#22 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/ServerContainer.php(132): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('AppConfig')\\n#23 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/Server.php(1336): OC\\\\ServerContainer->query('AppConfig')\\n#24 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/legacy\\\/app.php(961): OC\\\\Server->getAppConfig()\\n#25 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/TemplateLayout.php(206): OC_App::getAppVersions()\\n#26 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/TemplateLayout.php(158): OC\\\\TemplateLayout->getVersionHashSuffix()\\n#27 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/legacy\\\/template.php(207): OC\\\\TemplateLayout->__construct('error', '')\\n#28 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/Template\\\/Base.php(132): OC_Template->fetchPage()\\n#29 \\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/legacy\\\/template.php(351): OC\\\\Template\\\\Base->printPage()\\n#30 \\\/srv\\\/projects\\\/server\\\/index.php(71): OC_Template::printExceptionErrorPage(Object(Doctrine\\\\DBAL\\\\DBALException))\\n#31 {main}\",\"File\":\"\\\/srv\\\/projects\\\/server\\\/lib\\\/private\\\/DB\\\/Connection.php\",\"Line\":64}","userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit\/604.3.5 (KHTML, like Gecko) Version\/11.0.1 Safari\/604.3.5","version":""}

Let me fix this.

@MorrisJobke
Copy link
Member

Let me fix this.

#7449 <- that then also should be backported together with this PR.

@rullzer
Copy link
Member

rullzer commented Dec 11, 2017

@skjnldsv please prepare the backport

@MorrisJobke
Copy link
Member

@skjnldsv I guess this backport didn't made it yet, right?

@skjnldsv
Copy link
Member Author

skjnldsv commented Jan 9, 2018

Oups, my bad!

@MorrisJobke
Copy link
Member

I would like to wait for 12.0.6 for this, is this okay?

@skjnldsv
Copy link
Member Author

skjnldsv commented Jan 9, 2018

Okay for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement medium technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants