~etherpad/etherpad/ubuntu-lucid-backport

« back to all changes in this revision

Viewing changes to etherpad/src/etherpad/db_migrations/m0036_create_missing_subscription_records.js

  • Committer: James Page
  • Date: 2011-04-13 08:00:43 UTC
  • Revision ID: james.page@canonical.com-20110413080043-eee2nq7y1v7cv2mp
* Refactoring to use native Ubuntu Java libraries. 
* debian/control:
  - use openjdk instead of sun's java
  - update maintainer
* debian/etherpad.init.orig, debian/etherpad.upstart:
  - move the init script out of the way
  - create a basic upstart script
  - note that the open office document conversion daemon was dropped
    from the upstart configuration; if this behavior is desired, please
    create a separate upstart job for it
* debian/rules:
  - just use basic dh_installinit, as it will pick up the new upstart job
* New release
* Changed maintainer to Packaging
* Fixed installation scripts
* Initial Release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Copyright 2009 Google Inc.
 
3
 * 
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 * 
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 * 
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS-IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
import("dateutils");
 
18
import("etherpad.utils.isPrivateNetworkEdition");
 
19
import("sqlbase.sqlobj");
 
20
 
 
21
function run() {
 
22
  if (isPrivateNetworkEdition()) {
 
23
    return;
 
24
  }
 
25
  
 
26
  var allDomains = sqlobj.selectMulti('pro_domains', {}, {});
 
27
  
 
28
  allDomains.forEach(function(domain) {
 
29
    var domainId = domain.id;
 
30
    var accounts = sqlobj.selectMulti('pro_accounts', {domainId: domainId}, {});
 
31
    if (accounts.length > 3) {
 
32
      if (! sqlobj.selectSingle('billing_purchase', {product: "ONDEMAND", customer: domainId}, {})) {
 
33
        sqlobj.insert('billing_purchase', {
 
34
          product: "ONDEMAND",
 
35
          paidThrough: dateutils.noon(new Date(Date.now()-1000*86400)),
 
36
          type: 'subscription',
 
37
          customer: domainId,
 
38
          status: 'inactive',
 
39
          cost: 0,
 
40
          coupon: ""
 
41
        });
 
42
      }
 
43
    }
 
44
  });
 
45
}
 
 
b'\\ No newline at end of file'