Writes content access string to database
973281
async def set_access_string(self, **params):
		
		if params.get("message"):
			params = json.loads(params.get("message", "{}"))

		cid = int(params.get("cid", "0"))
		seller_access_string = params.get("seller_access_string")
		seller_pubkey = params.get("seller_pubkey")
		coinid = params.get("coinid")

		try:
			coinid = coinid.replace("TEST", "")
		except:
			pass

		database = client[coinid]
		collection = database[settings.CONTENT]
		content = await collection.find_one({"cid":cid})

		if not content:
			return {"error":404, "reason":"Content not found"}

		if not all([cid, seller_access_string, seller_pubkey]):
			return {"error":400, "reason":"Missed required fields"}

		await collection.find_one_and_update({"cid":cid},
						{"$set":{"seller_access_string":seller_access_string}})

		await collection.find_one_and_update({"cid":cid},
						{"$set":{"seller_pubkey":seller_pubkey}})

		content = await collection.find_one({"cid":cid})
		return {i:content[i] for i in content if i != "_id"}
9732
private void doGetDatasource() throws PageException {

	String name = getString("admin", action, "name");
	Map ds = config.getDataSourcesAsMap();
	Iterator it = ds.keySet().iterator();

	while (it.hasNext()) {
	    String key = (String) it.next();
	    if (key.equalsIgnoreCase(name)) {
		DataSource d = (DataSource) ds.get(key);
		Struct sct = new StructImpl();
		ClassDefinition cd = d.getClassDefinition();

		sct.setEL(KeyConstants._name, key);
		sct.setEL(KeyConstants._host, d.getHost());
		sct.setEL("classname", cd.getClassName());
		sct.setEL("class", cd.getClassName());
		sct.setEL("bundleName", cd.getName());
		sct.setEL("bundleVersion", cd.getVersionAsString());
		sct.setEL("dsn", d.getDsnOriginal());
		sct.setEL("database", d.getDatabase());
		sct.setEL("port", d.getPort() < 1 ? "" : Caster.toString(d.getPort()));
		sct.setEL("dsnTranslated", d.getDsnTranslated());
		sct.setEL("timezone", toStringTimeZone(d.getTimeZone()));
		sct.setEL("password", d.getPassword());
		sct.setEL("passwordEncrypted", ConfigWebUtil.encrypt(d.getPassword()));
		sct.setEL("username", d.getUsername());
		sct.setEL("readonly", Caster.toBoolean(d.isReadOnly()));
		sct.setEL("select", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_SELECT)));
		sct.setEL("delete", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DELETE)));
		sct.setEL("update", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_UPDATE)));
		sct.setEL("insert", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_INSERT)));
		sct.setEL("create", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_CREATE)));
		sct.setEL("insert", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_INSERT)));
		sct.setEL("drop", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DROP)));
		sct.setEL("grant", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_GRANT)));
		sct.setEL("revoke", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_REVOKE)));
		sct.setEL("alter", Boolean.valueOf(d.hasAllow(DataSource.ALLOW_ALTER)));

		sct.setEL("connectionLimit", d.getConnectionLimit() < 1 ? "-1" : Caster.toString(d.getConnectionLimit()));
		sct.setEL("connectionTimeout", d.getConnectionTimeout() < 1 ? "" : Caster.toString(d.getConnectionTimeout()));
		sct.setEL("metaCacheTimeout", Caster.toDouble(d.getMetaCacheTimeout()));
		sct.setEL("custom", d.getCustoms());
		sct.setEL("blob", Boolean.valueOf(d.isBlob()));
		sct.setEL("clob", Boolean.valueOf(d.isClob()));
		sct.setEL("validate", Boolean.valueOf(d.validate()));
		sct.setEL("storage", Boolean.valueOf(d.isStorage()));
		if (d instanceof DataSourceImpl) {
		    DataSourceImpl di = ((DataSourceImpl) d);
		    sct.setEL("literalTimestampWithTSOffset", Boolean.valueOf(di.getLiteralTimestampWithTSOffset()));
		    sct.setEL("alwaysSetTimeout", Boolean.valueOf(di.getAlwaysSetTimeout()));

		    sct.setEL("dbdriver", Caster.toString(di.getDbDriver(), ""));
		}
		pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
		return;
	    }
	}
	throw new ApplicationException("there is no datasource with name [" + name + "]");
    }
1230854
@Override
  public boolean writeEvent(AuditEvent event) throws HandlerException {
    StringBuilder elements = new StringBuilder();
    for (Field element : event.getFields()) {
      elements.append(
        element.getName() + " " + element.getType() + ":" + element.getValue() + ", ");
    }

    try (Connection conn = getConnection()) {
      try (PreparedStatement statement = conn.prepareStatement(insertQuery)) {
        statement.setString(1, event.getUuid().toString());
        statement.setTimestamp(2, new Timestamp(event.getTimestamp().getTime()));
        statement.setString(3, event.getActor());
        statement.setString(4, event.getOrigin());
        statement.setString(5, event.getAction());
        statement.setString(6, elements.toString());

        return statement.execute();
      }
    } catch (SQLException e) {
      throw new HandlerException("SQL Exception", DatabaseAuditHandler.class, e);
    }
  }
1189800
function tableBox($contents, $direct_output = false) {
    $tableBox_string = '<table border="' . zen_output_string($this->table_border) . '" width="' . zen_output_string($this->table_width) . '" cellspacing="' . zen_output_string($this->table_cellspacing) . '" cellpadding="' . zen_output_string($this->table_cellpadding) . '"';
    if (zen_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
    $tableBox_string .= '>' . "\n";

    for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
      if (isset($contents[$i]['form']) && zen_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
      $tableBox_string .= '  <tr';
      if (zen_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
      if (isset($contents[$i]['params']) && zen_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
      $tableBox_string .= '>' . "\n";

      if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
        for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
          if (isset($contents[$i][$x]['text']) && zen_not_null($contents[$i][$x]['text'])) {
            $tableBox_string .= '    <td';
            if (isset($contents[$i][$x]['align']) && zen_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . zen_output_string($contents[$i][$x]['align']) . '"';
            if (isset($contents[$i][$x]['params']) && zen_not_null($contents[$i][$x]['params'])) {
              $tableBox_string .= ' ' . $contents[$i][$x]['params'];
            } elseif (zen_not_null($this->table_data_parameters)) {
              $tableBox_string .= ' ' . $this->table_data_parameters;
            }
            $tableBox_string .= '>';
            if (isset($contents[$i][$x]['form']) && zen_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
            $tableBox_string .= $contents[$i][$x]['text'];
            if (isset($contents[$i][$x]['form']) && zen_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
            $tableBox_string .= '</td>' . "\n";
          }
        }
      } else {
        $tableBox_string .= '    <td';
        if (isset($contents[$i]['align']) && zen_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . zen_output_string($contents[$i]['align']) . '"';
        if (isset($contents[$i]['params']) && zen_not_null($contents[$i]['params'])) {
          $tableBox_string .= ' ' . $contents[$i]['params'];
        } elseif (zen_not_null($this->table_data_parameters)) {
          $tableBox_string .= ' ' . $this->table_data_parameters;
        }
        $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
      }

      $tableBox_string .= '  </tr>' . "\n";
      if (isset($contents[$i]['form']) && zen_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
    }

    $tableBox_string .= '</table>' . "\n";

    if ($direct_output == true) echo $tableBox_string;

    return $tableBox_string;
  }
1146295
@Override
    public Uri insert(Uri uri, ContentValues values) {
        Uri result = null;

        if (!controller.hasPreinitialized()) {
            throw new IllegalStateException("Controller has not been initialized.");
        }

        int patternCode = controller.getUriMatcher().match(uri);
        MatcherPattern pattern = controller.findMatcherPattern(patternCode);
        if (pattern == null) {
            throw new IllegalArgumentException("unknown uri : " + uri.toString());
        }

        Parameter parameter = new Parameter(uri, values);
        SQLiteDatabase db = this.getHelper().getWritableDatabase();

        result = onInsert(this.getHelper(), db, pattern, parameter);
        if (result != null) {
            this.onInsertCompleted(result, uri, pattern, parameter);
        }
        return result;
    }
346844
public int checkAccessControl(Database database, String deviceName, TangoUrl devUrl) {
        int access = TangoConst.ACCESS_WRITE;
        synchronized (monitor) {
            if (database.devname==null)
                database.devname = database.device.name();
            if (deviceName.equals(database.devname) && database.isAccess_checked())
                return database.access;
            try {
                //	Else create proxy
                //	Check if AccessProxy object already exists
                if (/*!database.isAccess_checked() &&*/ database.getAccess_proxy()==null) {
                    //	Check if access deviceName is from env (for tests)
                    String access_deviceName = ApiUtil.getAccessDevname();
                    if (access_deviceName==null || access_deviceName.length()==0) {
                        if (access_service_read)
                            if (!database.check_access)
                                return TangoConst.ACCESS_WRITE;

                        //	Get Access service
                        String[] services =
                                getServices(database, TangoConst.ACCESS_SERVICE, "*");
                        if (services.length>0)
                            access_deviceName = services[0];
                        else {
                            //	if not set --> No check
                            //System.out.println("No Access Service Found !");
                            database.check_access = false;
                            access_service_read = true;
                            return TangoConst.ACCESS_WRITE;
                        }
                    }
                    // If tango_host not from env -> add tango_host as header for access device name
                    //  Check if header not already in access_deviceName :-)
                    if (!devUrl.fromEnv && !access_deviceName.startsWith("tango://"))
                        access_deviceName = "tango://" + devUrl.host + ":" + devUrl.port + "/" + access_deviceName;

                    //	Then build Tango Access Control Proxy
                    database.setAccess_proxy(new AccessProxy(access_deviceName));
                }
                if (database.getAccess_proxy()!=null) {
                    access = database.getAccess_proxy().checkAccessControl(deviceName);
                }

                //	if database access not already checked, and not first import -> do it now
                if (!database.isAccess_checked())
                    if (!deviceName.equals(database.device.name()))
                        checkAccess(database);

            } catch (DevFailed e) {
                //	In case of failure, returns always TangoConst.ACCESS_READ
                access = TangoConst.ACCESS_READ;
                //	if cannot import AccessProxy
                //	-> change description to be more explicit
                if (e.errors.length>1)
                    if (e.errors[1].reason.equals("TangoApi_CANNOT_IMPORT_DEVICE"))
                        e.errors[0].desc +=
                                "\nControlled access service defined in Db but unreachable --> Read Only access given to all devices...";

                database.setAccess_devfailed(e);
                //Except.print_exception(e);
            }
        }
        return access;
    }
1023798
public static String toStringAccess(int access) throws ApplicationException {
	String res = toStringAccess(access, null);
	if (res != null) return res;
	throw new ApplicationException(
		"invalid access type [" + access + "], access types are Component.ACCESS_PACKAGE, Component.ACCESS_PRIVATE, Component.ACCESS_PUBLIC, Component.ACCESS_REMOTE");
    }
474383
def write_users(dburl):
    """"""
    data = {
        'username': 'admin',
        'realname': 'Website Administrator',
        'email': 'coil@example.com',
        'password':
            r'$bcrypt-sha256$2a,12$NNtd2TC9mZO6.EvLwEwlLO$axojD34/iE8x'
            r'QitQnCCOGPhofgmjNdq',
    }

    for p in PERMISSIONS:
        data[p] = '1'

    db = redis.StrictRedis.from_url(dburl)
    db.hmset('user:1', data)
    db.hset('users', 'admin', '1')
    if not db.exists('last_uid'):
        db.incr('last_uid')

    print("Username: admin")
    print("Password: admin")
    return 0
21953
function write($content, $inByte = null)
    {
        $this->_assertWritable();

        $stream = $this->resource()->getRHandler();

        $inByte = ($inByte === null)
            ? $this->getBuffer()
            : $inByte;


        $content = (string) $content;
        if (null === $inByte)
            $ret = fwrite($stream, $content);
        else
            $ret = fwrite($stream, $content, $inByte);

        if (false === $ret)
            throw new \RuntimeException('Cannot write on stream.');

        $transCount = $inByte;
        if ($transCount === null) {
            if (function_exists('mb_strlen'))
                $transCount = mb_strlen($content, '8bit');
            else
                $transCount = strlen($content);
        }

        $this->_resetTransCount($transCount);
        return $this;
    }
164967
function toString( $contentObjectAttribute )
    {
        $objectAttributeContent = $contentObjectAttribute->attribute( 'content' );
        $objectIDList = array();
        foreach( $objectAttributeContent['relation_list'] as $objectInfo )
        {
            $objectIDList[] = $objectInfo['contentobject_id'];
        }
        return implode( '-', $objectIDList );
    }
631577
def write(self, oprot):
        '''
        
        '''

        oprot.write_struct_begin('DatabaseConfiguration')

        if self.dbf is not None:
            oprot.write_field_begin(name='dbf', type=12, id=None)
            self.dbf.write(oprot)
            oprot.write_field_end()

        if self.dummy is not None:
            oprot.write_field_begin(name='dummy', type=12, id=None)
            self.dummy.write(oprot)
            oprot.write_field_end()

        if self.online is not None:
            oprot.write_field_begin(name='online', type=12, id=None)
            self.online.write(oprot)
            oprot.write_field_end()

        oprot.write_field_stop()

        oprot.write_struct_end()

        return self
1126065
public void write(ProgressVisitor progress, ResultSet rs, File fileName, String encoding) throws SQLException, IOException {
        if (FileUtil.isExtensionWellFormated(fileName, "json")) {
            JsonEncoding jsonEncoding = JsonEncoding.UTF8;
            if (encoding != null) {
                try {
                    jsonEncoding = JsonEncoding.valueOf(encoding);
                } catch (IllegalArgumentException ex) {
                    throw new SQLException("Only UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE encoding is supported");
                }
            }
            FileOutputStream fos = null;
            try {
            fos = new FileOutputStream(fileName);
            int rowCount = 0;
                int type = rs.getType();
                if (type == ResultSet.TYPE_SCROLL_INSENSITIVE || type == ResultSet.TYPE_SCROLL_SENSITIVE) {
                    rs.last();
                    rowCount = rs.getRow();
                    rs.beforeFirst();
                }
                ProgressVisitor copyProgress = progress.subProcess(rowCount);   
                try ( // Read table content
                    Statement st = connection.createStatement()) {
                    JsonFactory jsonFactory = new JsonFactory();
                    JsonGenerator jsonGenerator = jsonFactory.createGenerator(new BufferedOutputStream(fos), jsonEncoding);                    
                    try {
                        ResultSetMetaData rsmd = rs.getMetaData();
                        int numColumns = rsmd.getColumnCount();
                        while (rs.next()) {
                            jsonGenerator.writeStartObject();
                            for (int i = 1; i < numColumns + 1; i++) {
                                String column_name = rsmd.getColumnName(i);
                                switch (rsmd.getColumnType(i)) {
                                    case java.sql.Types.ARRAY:
                                        Object[] values = (Object[]) rs.getArray(i).getArray();
                                        if(values !=null){
                                            jsonGenerator.writeArrayFieldStart(column_name);
                                            for (Object value : values) {
                                                jsonGenerator.writeObject(value);
                                            }
                                            jsonGenerator.writeEndArray();
                                        }
                                        break;
                                    case java.sql.Types.BIGINT:
                                        jsonGenerator.writeObjectField(column_name, rs.getLong(i));
                                        break;
                                    case java.sql.Types.REAL:
                                        jsonGenerator.writeObjectField(column_name, rs.getFloat(i));
                                        break;
                                    case java.sql.Types.BOOLEAN:
                                        jsonGenerator.writeObjectField(column_name, rs.getBoolean(i));
                                        break;
                                    case java.sql.Types.BLOB:
                                        jsonGenerator.writeObjectField(column_name, rs.getBlob(i));
                                        break;
                                    case java.sql.Types.DOUBLE:
                                        jsonGenerator.writeObjectField(column_name, rs.getDouble(i));
                                        break;
                                    case java.sql.Types.FLOAT:
                                        jsonGenerator.writeObjectField(column_name, rs.getDouble(i));
                                        break;
                                    case java.sql.Types.INTEGER:
                                        jsonGenerator.writeObjectField(column_name, rs.getInt(i));
                                        break;
                                    case java.sql.Types.NVARCHAR:
                                        jsonGenerator.writeObjectField(column_name, rs.getNString(i));
                                        break;
                                    case java.sql.Types.VARCHAR:
                                        jsonGenerator.writeObjectField(column_name, rs.getString(i));
                                        break;
                                    case java.sql.Types.CHAR:
                                        jsonGenerator.writeObjectField(column_name, rs.getString(i));
                                        break;
                                    case java.sql.Types.NCHAR:
                                        jsonGenerator.writeObjectField(column_name, rs.getNString(i));
                                        break;
                                    case java.sql.Types.LONGNVARCHAR:
                                        jsonGenerator.writeObjectField(column_name, rs.getNString(i));
                                        break;
                                    case java.sql.Types.LONGVARCHAR:
                                        jsonGenerator.writeObjectField(column_name, rs.getString(i));
                                        break;
                                    case java.sql.Types.TINYINT:
                                        jsonGenerator.writeObjectField(column_name, rs.getByte(i));
                                        break;
                                    case java.sql.Types.SMALLINT:
                                        jsonGenerator.writeObjectField(column_name, rs.getShort(i));
                                        break;
                                    case java.sql.Types.DATE:
                                        jsonGenerator.writeObjectField(column_name, rs.getDate(i));
                                        break;
                                    case java.sql.Types.TIME:
                                        jsonGenerator.writeObjectField(column_name, rs.getTime(i));
                                        break;
                                    case java.sql.Types.TIMESTAMP:
                                        jsonGenerator.writeObjectField(column_name, rs.getTimestamp(i));
                                        break;
                                    case java.sql.Types.BINARY:
                                        jsonGenerator.writeObjectField(column_name, rs.getBytes(i));
                                        break;
                                    case java.sql.Types.VARBINARY:
                                        jsonGenerator.writeObjectField(column_name, rs.getBytes(i));
                                        break;
                                    case java.sql.Types.LONGVARBINARY:
                                        jsonGenerator.writeObjectField(column_name, rs.getBinaryStream(i));
                                        break;
                                    case java.sql.Types.BIT:
                                        jsonGenerator.writeObjectField(column_name, rs.getBoolean(i));
                                        break;
                                    case java.sql.Types.CLOB:
                                        jsonGenerator.writeObjectField(column_name, rs.getClob(i));
                                        break;
                                    case java.sql.Types.NUMERIC:
                                        jsonGenerator.writeObjectField(column_name, rs.getBigDecimal(i));
                                        break;
                                    case java.sql.Types.DECIMAL:
                                        jsonGenerator.writeObjectField(column_name, rs.getBigDecimal(i));
                                        break;
                                    case java.sql.Types.DATALINK:
                                        jsonGenerator.writeObjectField(column_name, rs.getURL(i));
                                        break;
                                    case java.sql.Types.REF:
                                        jsonGenerator.writeObjectField(column_name, rs.getRef(i));
                                        break;
                                    case java.sql.Types.STRUCT:
                                        jsonGenerator.writeObjectField(column_name, rs.getObject(i));
                                        break;
                                    case java.sql.Types.DISTINCT:
                                        jsonGenerator.writeObjectField(column_name, rs.getObject(i));
                                        break;
                                    case java.sql.Types.JAVA_OBJECT:
                                        jsonGenerator.writeObjectField(column_name, rs.getObject(i));
                                        break;
                                    default:
                                        jsonGenerator.writeObjectField(column_name, rs.getString(i));
                                        break;
                                }
                            }
                            jsonGenerator.writeEndObject();

                            copyProgress.endStep();
                        }
                        copyProgress.endOfProgress();
                        jsonGenerator.flush();
                        jsonGenerator.close();
                    } finally {
                        rs.close();
                    }
                }
            
        } catch (FileNotFoundException ex) {
            throw new SQLException(ex);

        } finally {
            try {
                if (fos != null) {
                    fos.close();
                }
                } catch (IOException ex) {
                    throw new SQLException(ex);
                }
            }
        } else {
            throw new SQLException("Only .json extension is supported");
        }
    }
1321567
def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
    '''
    
    '''
    set_ca_path(cacert_path)
    ca_dir = '{0}/{1}'.format(cert_base_path(), ca_name)
    index_file, expire_date, serial_number, subject = _get_basic_info(
        ca_name,
        cert,
        ca_dir)

    index_data = '{0}\t{1}\t\t{2}\tunknown\t{3}'.format(
        status,
        expire_date,
        serial_number,
        subject
    )

    with salt.utils.files.fopen(index_file, 'a+') as ofile:
        ofile.write(salt.utils.stringutils.to_str(index_data))
408601
private static void writeString(String str, DataOutput writer) throws IOException {
		if (str == null) {
			writer.writeInt(0);
		} else {
			int blocks = str.length() >> 15;
			writer.writeInt(blocks+1);
			int end = 0;
			for (int i=0; i<blocks; i++) {
				int start = end;
				end = (i+1)<<15;
				writer.writeUTF(str.substring(start, end));
			}
			writer.writeUTF(str.substring(end));
		}
	}
617605
def WriteAPIAuditEntry(self, entry, cursor=None):
    """"""
    args = {
        "username":
            entry.username,
        "router_method_name":
            entry.router_method_name,
        "details":
            entry.SerializeToString(),
        "timestamp":
            mysql_utils.RDFDatetimeToTimestamp(rdfvalue.RDFDatetime.Now()),
    }
    query = """
    INSERT INTO api_audit_entry (username, router_method_name, details,
        timestamp)
    VALUES (%(username)s, %(router_method_name)s, %(details)s,
        FROM_UNIXTIME(%(timestamp)s))
    """
    cursor.execute(query, args)
1365617
private void actionWrite() throws PageException {
	if (output == null) throw new ApplicationException("attribute output is not defined for tag file");
	checkFile(pageContext, securityManager, file, serverPassword, createPath, true, false, true);
	if (file.exists()) {
	    // Error
	    if (nameconflict == NAMECONFLICT_ERROR) throw new ApplicationException("destination file [" + file + "] already exist");
	    // SKIP
	    else if (nameconflict == NAMECONFLICT_SKIP) return;
	    // OVERWRITE
	    else if (nameconflict == NAMECONFLICT_OVERWRITE) file.delete();
	}

	setACL(pageContext, file, acl);
	try {
	    if (output instanceof InputStream) {
		IOUtil.copy((InputStream) output, file, false);
	    }
	    else if (Decision.isCastableToBinary(output, false)) {
		IOUtil.copy(new ByteArrayInputStream(Caster.toBinary(output)), file, true);
	    }
	    else {
		String content = Caster.toString(output);
		if (fixnewline) content = doFixNewLine(content);
		if (addnewline) content += SystemUtil.getOSSpecificLineSeparator();

		IOUtil.write(file, content, CharsetUtil.toCharset(charset), false);

	    }
	}
	catch (UnsupportedEncodingException e) {
	    throw new ApplicationException("Unsupported Charset Definition [" + charset + "]", e.getMessage());
	}
	catch (IOException e) {

	    throw new ApplicationException("can't write file " + file.getAbsolutePath(), e.getMessage());
	}
	setMode(file, mode);
	setAttributes(file, attributes);
    }
618703
def write_to_db(key, value)
      db_setting = Configuration.find_or_create_by(name: namespaced_key(key))
      db_setting.update_attribute(:value, value)
    end